Brian Laws celebrated his first three points as Burnley boss as the Clarets ended their long wait for a victory to climb out of the relegation zone with a crucial win over struggling West Ham.
New boy Danny Fox made a dream start to his Clarets' career as he scored what turned out to be the winner with a superb free-kick ten minutes into the second half.
David Nugent also marked his transfer window return with a goal as the Clarets secured their first win in 13 attempts stretching back to the end of October.
And while Ilan's late strike set up a nerve-shredding finish and ended hopes of a first clean sheet since that win over Hull, the Clarets got their campaign back up and running as they climbed to 15th place in the table.
Not surprisingly Laws gave an instant debut to Fox following his deadline day arrival from Celtic and the left-back quickly made his mark - at both ends of the pitch.
It was his booming ball from the back that allowed Nugent to strike as the Clarets made the most of their bright start.
England defender Matthew Upson was badly caught out and Nugent, starting the first game of his second loan spell, pounced with 14 minutes gone.
Nipping between Upson and goalkeeper Robert Green, the striker had little room to manoeuvre but judged his lob perfectly to clear Green and bounce below the bar to give Burnley the lead they craved.
David Nugent puts the Clarets ahead
The Clarets had been bright and inventive in possession but West Ham, without a win away from home since the opening day, re-grouped and gradually exerted some pressure of their own.
Fox made two vital interceptions on the edge of the six yard box as he first cleared a dangerous cross from Benni McCarthy and then got there just before Carlton Cole as a skidding shot from Jack Collison was half blocked by Tyrone Mears.
But that was nothing compared to the escape performed by Leon Cort after 33 minutes as he guaranteed that Burnley would go into the break ahead.
The increasingly influential Scott Parker sent the Hammers surging forward and when he slipped the ball through for McCarthy, the former Blackburn Rovers striker looked a certain scorer after rounding Brian Jensen.
That 'goal-den' feeling
But Cort refused to give up the cause and got back to hack McCarthy's effort off the line at full stretch.
Cort was proving a colossus as he also made a couple of important blocks early in the second half as West Ham came quickly out the traps in search of a leveller.
Manager Gianfranco Zola replaced McCarthy with fellow new boy Mido and the much-travelled Egyptian fired a warning shot with an angled drive which flew wide.
Burnley needed to relieve the pressure and they did it in the perfect style thanks to that man Fox.
His skill from set-pieces had been one of the main attractions for Laws when he made his move for the former Coventry City man the his judgement was immediately vindicated.
The maurauding Tyrone Mears earned the free-kick with a dangerous run forward which was ended by a push in the back by Collison on the side of the penalty area.
That gave Fox the chance to eye up the top corner and the Scotland international duly took aim and curled a beauty past Green to make it 2-0.
Danny Fox finds the top corner
That gave Burnley just the breathing space they needed, although only a superb save from Jensen preserved the two-goal cushion as Parker almost struck back straight away with a carefully placed shot which was destined for the bottom corner until Jensen flung himself to palm the ball away.
The Clarets held their collective breath again after 67 minutes when Cole had the ball in the net but from James Tomkins' downward header the England striker was off-side inside the six-yard box.
Then after Steven Fletcher had headed wide at the other end from a rare Burnley break, Junior Stanislas curled a free-kick against the bar as the Hammers strove to get back in the game.
And with ten minutes to go they did just that as Burnley's defence finally cracked. The Hammers' patient build-up finally paid off when Cole's chipped ball into the box had defenders and Jensen scrambling to clear and when the ball squirmed loose, substitute Ilan fired home with his first touch.
That set the nerves jangling and in the 90th-minute the Clarets nearly saw two priceless points disappear as Mido stretched out a leg and diverted the ball against the post.
Burnley then had to survive five minutes of added time but hung on to record a desperately needed result to kick-start their survival mission.
Burnley: Jensen, Mears, Carlisle, Cort, Fox (Edgar 85), Bikey, Nugent (Thompson 88), McDonald, Elliott, Fletcher, Blake (Paterson 73). Subs: Duff, Eagles, Cork, Weaver.
West Ham: Green, Faubert, Upson, Tomkins, Spector, Behrami, Noble (Ilan 77), Parker, Collison (Stanislas 62), Cole, McCarthy (Mido ht). Subs: Stech, Kovac, Ilunga, Da Costa.
Referee: Howard Webb