Jonas Gutierrez signed off from his Newcastle career in style by cementing a first victory in three months to end the club's Barclays Premier League relegation fears.
The 31-year-old Argentinian, playing his final game for the club after recovering from testicular cancer, had already set up Moussa Sissoko for the opening goal nine minutes after half-time when he drilled home a second with five minutes of the game remaining, condemning West Ham to a 2-0 defeat and Hull to the drop.
It was a fitting end to a traumatic season for the Magpies, who last collected three points on February 28, and he, his team-mates and head coach John Carver celebrated wildly on a day when the outcome could have been so very different.
It was just the third league win of Carver's 19-game reign, but it could not have come at a better time in what was Hammers boss Sam Allardyce's final game with anything less leaving them to sweat on Hull failing to beat Manchester United.
On a day when owner Mike Ashley gave an unprecedented television interview and insisted he would not sell the club until it had won something under him, the players responded with a performance of real character with failure simply not an option.
Newcastle set about their task with vigour with Sissoko and Daryl Janmaat linking well down the right and Emmanuel Riviere in combative mood alongside fellow frontman Papiss Cisse.
Indeed, the Frenchman might have given the Magpies a first-minute lead when Sissoko's cross eventually fell to his right foot, but he lashed the ball across goal and agonisingly wide of the far post.
He went much closer in spectacular fashion five minutes later when he acrobatically volleyed just wide from Janmaat's inviting cross.
However, in the meantime, the locals inside St James' Park had held their breath when Enner Valencia went down under Mike Williamson's challenge inside the area, but referee Martin Atkinson was unmoved.
Janmaat was proving a real threat down the Magpies' right, and he went just wide from distance on two occasions and planted a header off target from Jack Colback's cross five minutes before the break.
But as the Holland international repeatedly surged forward, West Ham full-back Aaron Cresswell took advantage of the space he left behind and twice sent dangerous crosses into Tim Krul's penalty area, one of which proved only just too strong for Valencia.
It was he who created the visitors' clearest opening of the first half when he played Stewart Downing in behind the Newcastle defence, but Krul blocked well with his legs to preserve his clean sheet.
The home side should have taken a 52nd-minute lead when Janmaat got the better of Cresswell and surged into the box before rolling a pass into Riviere's path, but he miskicked with just keeper Adrian to beat.
But the Toon Army had to wait just two minutes longer for something to shout about as Gutierrez worked space on the left to cross for Sissoko to climb high above Winston Reid and Cresswell and power a downward header past Adrian.
The atmosphere at St James' was raucous as the anger and frustration of the last few months was replaced, perhaps only temporarily, with joy and relief.
On the pitch, the goal seemed to take more of a toll on the Magpies than it did on their visitors, and old boy Kevin Nolan was very nearly handed a chance to equalise as concentration levels dipped.
However, the game remained finally balanced heading into the closing stages with Vurnon Anita passing up a glorious opportunity to kill it off when he broke from his own half along with Sissoko, Papiss Cisse and Colback and not a claret and blue shirt in sight, but somehow managed to serve the ball up to Adrian.
But Gutierrez had the final say with five minutes remaining when he smashed a skidding shot past the keeper with the help of a deflection to end the quest for survival in style.