Ilan (centre) followed up his goal at Everton with another at home
Brazilian striker Ilan's second goal in as many games moved West Ham four points clear of the relegation zone.
After a tense first half, the Hammers lifted the mood, breaching the Sunderland defence on 51 minutes.
Manuel da Costa's long free-kick was flicked on by Carlton Cole, straight into the path of Ilan, who poked home.
Lee Cattermole and Darren Bent went close for Sunderland but West Ham held their nerve in a fractious finale to pick up a vital Premier League win.
Considering the home side's precarious position in the table, there was a strange lack of urgency to the opening stages.
Zola delighted with 'deserved' win
The first goal threat at either end came when Steed Malbranque's long pass put through Bent, who spotted Hammers goalkeeper Robert Green off his line, but his lob went onto the roof of the net.
West Ham's Valon Behrami forced the first real save of the game when his effort from outside the box had Craig Gordon at full stretch, but this was a rare moment of activity for either goalkeeper.
The absence of pressure on Sunderland allowed them to put on a good passing display, and Malbranque always looked capable of creating something, but the home side showed a greater willingness to go for goal.
Radoslav Kovac shot over from outside the box and shortly before the interval, the east Londoners wasted the best chance of the match so far.
Junior Stanislas dispossessed former West Ham trainee Kieran Richardson outside the box and fed the ball in to Cole, but when he offloaded it to Ilan, the Brazilian lost his footing at the vital moment and scuffed his shot.
Despite being West Ham's top scorer, Cole's first-half contribution was more about his physical presence, rather than goal threat, and he certainly gave Sunderland keeper Gordon some problems.
Under pressure from Cole, the Scottish international was panicked into conceding a free-kick for handling outside the box, which cost him a booking, and minutes later he rugby-tackled the England striker in the penalty area, but the offside flag was already up against Cole.
And the England man's physical presence proved vital early in the second half as he set up West Ham's opening goal.
Da Costa's free-kick from the right, just inside his own half, found the head of Cole on the edge of the box and he flicked on for Ilan, who eluded his marker Paulo da Silva to prod the ball into the bottom corner.
Bruce disappointed with 'park football' defending
Cattermole shot inches wide and Kenwyne Jones's introduction gave Sunderland more threat, and Bent really should have done better when Jones put him through on goal, only to lose his footing at the vital moment.
Tempers on both sides frayed as time ran out, and Cole wasted a great chance to make sure of the points on 90 minute when he shot just wide.
Guillermo Franco thought he had added a second in injury-time but his effort was ruled out for hand-ball, but as it turned out Ilan's goal was enough to secure the victory.
West Ham boss Gianfranco Zola:
"The players put a lot of passion in. We got the three points we needed and deserved.
"Defensively the players really performed well. Everyone helped - the midfielders and the strikers. When that happens, then you have a possibility of doing well.
"We've improved our position but there is still a long way but we need to maintain our focus.
"The circumstances can change completely, but we made a lot of sacrifice to make things change. The three points will give us a boost in confidence."
Sunderland boss Steve Bruce:
"We never seemed to be in any danger, I couldn't see them scoring and I can't remember the keepers doing much.
"It was poor goal we gave away, considering we spoke about it at half time - that was their main threat.
"Our home form is exceptional, away it's something we have to look at it and be better. Today summed it up - we should be taking something from it, too many times we've been in the game and haven't done enough."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.