Manchester United have suffered infirmities when chasing championships in this part of east London before so they will surely view this comeback as a sign that the record-breaking 19th title is now on.
In 1992 a shock defeat at Upton Park was followed by Leeds taking the Championship and when West Ham United held on for a 1-1 draw on the last day in 1995 they allowed Blackburn to win the title despite losing at Liverpool. A defeat in this topsy-turvy affair could have been similarly damaging.
With Edwin van Der Sar left out as precaution due to a strain and Patrice Evra subsequently being replaced at half-time by Javier Hernández, with Ryan Giggs moved to left-back, the sense was that at 2-0 down, following two Mark Noble penalties, United were in disarray.
To this was added the so-far cumbersome touch of Wayne Rooney, who appeared immersed in one of those matches in which he and United could not turn possession into goals.
Before his second-half hat-trick Rooney's prime failure of control had occurred in front of Robert Green. From one of the countless corners United had won, and were taken by Giggs, the winger played the ball short to Fábio da Silva.
When the cross came in, Chris Smalling – the main target from United's corners – headed down to Rooney. But the ball bounced back off him, and West Ham cleared.
Avram Grant's band began the second half ahead courtesy of two sharp bits of attack, and two questionable offerings of defending from Patrice Evra and Nemanja Vidic.
First, Thomas Hitzlsperger launched a 60-yard pass that looped into Carlton Cole's stride. When he attempted to flip the ball over Evra's head the left-back paddled it away.
Fourteen minutes after Noble had sent Tomasz Kuszczak the wrong way from the spot, the midfielder had his second. Cole's deft footwork bamboozled Vidic and took the striker beyond him. The defender certainly tripped him, though whether it was inside the area was questionable. Noble this time blazed the penalty into Kuszczak's top left-hand corner.
After the break came the Rooney show. Michael Carrick was pulled down by Noble and from 25 yards the striker placed the free-kick to the left of Green. His second derived from Antonio Valencia's left-footed pass. Matthew Upson lost the striker and Rooney finished sweetly.
When Fábio's flick hit Upson's arm inside the area, Rooney collected his hat-tick with a smooth finish from the spot. Then Hernández tapped in to secure three invaluable points.