West Ham's forgotten man Andriy Yarmolenko boosted their survival hopes as he climbed off the bench to secure a last-gasp 3-2 win for the Hammers and dent Chelsea's bid for Champions League qualification.
The Ukrainian, who has spent most of the season missing through injury, stunned Chelsea with a minute remaining to lift West Ham three points clear of the relegation zone.
In a dramatic evening at the London Stadium Willian, who had given Chelsea the lead with a first-half penalty, pegged West Ham back to 2-2 with a spectacular free-kick.
The Hammers, spurred on by a sense of injustice at having a goal harshly disallowed by VAR and conceding the penalty moments later, had hit back to lead through Tomas Soucek and Michail Antonio, the two protagonists in the goal which was ruled out.
And Yarmolenko's dramatic winner meant West Ham completed an unlikely double over the Blues this season, while Frank Lampard's side missed the chance to climb to third.
The VAR controversy came in the 34th minute, when Czech midfielder Soucek bundled the ball home from a corner.
Stockley Park took almost four minutes to rule the goal out for another of those most marginal offside calls against Antonio, who was lying on the ground as Soucek lifted the ball over him.
The official explanation from the Professional Game Match Officials Board was that "Antonio was in an offside position and directly in the line of vision of Kepa Arrizabalaga".
Boss David Moyes looked angry and he was ready to explode moments later when Issa Diop tripped Christian Pulisic in the area and Willian tucked away the penalty.
But Soucek, the unlucky scorer of an own goal against Spurs after VAR failed to spot a handball, finally saw things go his way in first-half stoppage time.
Chelsea clearly had not learned their lesson as, from another corner, Soucek met the ball on exactly the same spot, rising above Cesar Azpilicueta at the far post to head his first goal for West Ham.
The home players barely celebrated, probably expecting another VAR check, but West Ham really had scored their first goal of the resumption.
Six minutes after the interval they had their second. Antonio appealed for a penalty when Antonio Rudiger tugged him over, but when that was waved away he simply got up, burst forward and converted Jarrod Bowen's cross.
Willian's memorable leveller, a stunning dead-ball strike in off the far post, could have knocked the stuffing out of West Ham.
But the Hammers kept fighting and when Antonio fed Yarmolenko to fire home they had their first win of the restart and some much-needed daylight between them and the bottom three.