Matthew Etherington's late winner secured a narrow 2-1 victory over battling Gillingham and provided a much-needed boost to Hammers' promotion hopes.
After Bobby Zamora's early opener, the Kent-based outfit fought back to claim an equaliser before the break and then stood firm for much of the second half before finally capitulating with 15 minutes remaining.
It was the perfect tonic for Alan Pardew's team following last week's humiliating 4-1 defeat at arch-rivals Millwall, and moved us back into the play-off zone with just seven games remaining.
While the performance itself may not have been as comfortable or as convincing as the Hammers boss would have liked, there can be no doubting the importance of the three points, or indeed the character of the players to grind out the victory against a determined and resolute Gillingham side.
Despite admitting that he may have to make changes in defence after the hammering at the New Den, Pards simply didn't have the options to do so. With Hayden Mullins still not recovered from his back injury and Anton Ferdinand nursing a hamstring strain, Pardew wasn't even able to name a defender among his substitutes.
However, there was one welcome piece of news in the form of David Connolly's return to action. After missing three matches with a thigh injury picked up in the 5-0 win over his former club Wimbledon, the Republic of Ireland international came in alongside Zamora up front.
That meant a midfield reshuffle, as Marlon Harewood dropped back on the right and Kevin Horlock made way for Nigel Reo-Coker to return to the centre in tandem with Michael Carrick.
With an understandably tense and nervous Upton Park crowd awaiting the response of their team following last week's events in south London, it was a huge boost when Hammers got off to a perfect start, opening the scoring after just three minutes.
The first corner of the match was whipped in from the right by Carrick and flicked on by Harewood to the far post, where Zamora was on hand to guide the ball home from six yards out for his fourth goal in 10 appearances.
Hammers were handed a scare moments later when Gills striker Mamady Sidibe turned Andy Melville and fired a shot just inches wide of Stephen Bywater's left-hand upright, but the hosts continued to enjoy the better chances in the early stages and should really have added to their tally.
Zamora headed just wide in the 18th minute after good work between Connolly and Etherington, and then went even closer 10 minutes later when his low shot from 10 yards out was tipped round the post by Gills keeper Steve Banks - the former Upton Park trainee who was here just two weeks ago in the Wimbledon goal.
That miss proved costly, as the visitors grabbed an equaliser against the run of play just after the half hour mark. A long free-kick into the Hammers penalty area was headed down by Chris Hope and midfielder Danny Spiller was on hand to crash a volley past Bywater into the roof of the net.
To their credit, Hammers kept their heads up and bounced back in hope of restoring their advantage before the interval. Zamora came close again with a glancing header but the two sides went in level to leave the 34,551 crowd facing the jitters once again.
The hosts continued to press forward in the second half and again it was Zamora who found himself on the end of Hammers' best moves. He saw a shot from close range blocked in the 49th minute, had a low right-foot effort deflected just wide soon after, and also fed a quick free-kick to Etherington, whose strike was beaten out by Banks.
With just 20 minutes remaining, Pardew made a double substitution, sending on Adam Nowland and Brian Deane in place of Connolly and Reo-Coker, and the switch paid dividends soon after.
After providing some neat early touches, Nowland created the winner just five minutes after his arrival on the pitch, feeding a delightful pass into the path of Etherington, who skipped into the area and squeezed a low right-foot shot beyond the dive of Banks and into the far corner of the net.
It was almost 3-1 on 80 minutes, when Christian Dailly met Etherington's free-kick at the far post, but Banks pulled off a superb save to palm his header wide.
It would certainly have been nice to see the Hammers skipper round off the afternoon with a goal. After a couple of highly-publicised individual errors in recent weeks, the Scottish international was disgracefully booed every time he touched the ball by a very small minority of the home supporters.
As someone who has given blood, sweat and even a few teeth to the West Ham United cause this season and never provided anything less than 100% commitment in a claret and blue shirt, Dailly had every right to feel upset by the actions of some fans. However, in typical fashion, he refused to hide and gave a generally solid and fautless performance up against the dangerous Sidibe.
He and his team-mates will need to be equally focused next week, when Hammers visit play-off rivals Reading at the Madejski Stadium in the hope of rediscovering their terrific form away from home prior to the recent defeats at Sunderland and Millwall.
by Danny Francis