Debut boy Danny Fox handed Brian Laws his first win as Burnley boss with a stunning second-half free-kick but the Clarets were left clinging on desperately for the points as they beat West Ham 2-1.
The former Celtic left-back landed at Turf Moor last month in a #1.8million switch and it looks like money well spent after Fox helped his new side back to winning ways.
First he delivered the long ball in the 14th minute for David Nugent to lob home the opener. Then his curled free-kick from a tight angle in the 55th minute found the top corner.
It was just what Laws required after three straight league defeats since he replaced Owen Coyle - and a club run stretching back 12 long games to the end of October.
But it was still almost denied them as Hammers substitute Ilan reduced the deficit 10 minutes from time before Mido's low effort struck the base of the post with seconds remaining.
However, the late pressure could not hide another dismal performance from the visitors, who have their own relegation battle to contend with after seeing their run extended to one league win from 10.
Laws had made two changes to the side that pushed Chelsea close, and they combined to net the opener after a spell of early Hammers pressure had come to nothing.
Nugent's perfectly-weighted lob from just inside the box beat the advancing Green and gave Burnley and their vociferous fans just the start they needed.
The Hammers were offering precious little in response with their own debutant Benni McCarthy spooning his first chance wide then seeing a neat one-two with Mark Noble peter out.
Jack Collison had their best chance in the 25th minute when his drive struck Tyrone Mears and looped dangerously towards goal where Fox eventually cleared.
A rare opening for Carlton Cole on the half hour saw the striker make room down the right flank but he drifted too far and his eventual shot was easily gathered by Brian Jensen.
The Hammers came close in the 32nd minute when Scott Parker threaded a superb ball to McCarthy, who turned Jensen but saw his shot booted off the line by Leon Cort.
Mido replaced McCarthy at half-time and the Egyptian had the first chance of the second period when he was fed by Cole but lashed his shot high and wide.
Burnley increased their lead on 55 minutes after winning a free-kick on the edge of the box from Jack Collison's blatant push on Mears.
Fox stepped up to curl home a delicious set-piece from a tight angle on the right, the ball flashing into Green's top corner and giving the keeper no chance.
Parker came close to reducing the deficit almost immediately when his low shot was brilliantly tipped round the post by Burnley keeper Jensen.
Cole had the ball in the net in the 66th minute when he toe-poked home in a crowded box after a cross by Julian Faubert, but his effort was disallowed for offside.
The visitors came close again in the 71st minute when substitute Junior Stanislas almost outdid Fox, flinging in a free-kick from close to the left corner flag which skimmed the bar.
Then the Hammers battled back with Ilan stabbing home a loose ball in the box before Mido's dramatic late effort left the Clarets fans begging for the final whistle.
Copyright (c) PA Sport 2009, All Rights Reserved.
Do YOU want to write for GiveMeSport? Get started today by signing-up and submitting an article HERE: http://gms.to/writeforgms