Javier Hernandez's late double helped West Ham to a dramatic 4-3 comeback victory over rock-bottom Huddersfield at the London Stadium.
Hernandez found the net with headers in the 84th and 91st minute to break Huddersfield hearts after the visitors had raced into an unlikely 3-1 lead.
Angelo Ogbonna had pulled one back on 75 minutes to make it 3-2 after Juninho Bacuna (17) and Karlan Grant's double (30, 65) had turned the game on its head following Mark Noble's 15th-minute penalty.
The defeat means Huddersfield remain 16 points from safety at the bottom of the table, while West Ham are still ninth, but narrowed the gap to Watford in eighth to one point.
Michail Antonio had already hit the bar when Noble opened the scoring from the spot, striking the ball down the middle following 18-year-old debutant Aaron Rowe's foul on Manuel Lanzini.
Huddersfield responded straight away with Juninho Bacuna powering a header past Lukasz Fabianski from an Aaron Mooy corner for his first goal for the club.
They then took the lead before the break from a neatly worked free-kick. Bradley Pritchard fed Chris Lowe down the left and his low cross was scuffed into the bottom corner by Grant.
If his first goal was a mishit, Grant's second was special. The striker turned Issa Diop, shifted the ball onto his right foot to beat Ogbonna and arrowed a strike goalwards from the edge of the box, which Fabianski could only palm into the top corner.
But West Ham began their dramatic comeback ten minutes later through Ogbonna, who made the most of poor marking at a corner to give West Ham a lifeline with a bullet header.
Hernandez was introduced at half-time in place of Antonio and he got the equaliser, stooping low at the back post to nod Sami Nasri's cross into the bottom corner with a diving header.
And Hernandez was the hero in injury-time, marking his 50th Premier League appearance for West Ham in style when he flicked Felipe Anderson's pass into the far corner of the net in added-on time to leave the home faithful jubilant and Jan Siewert's side crestfallen.
The managers
Manuel Pellegrini: This is a match for the fans. Everyone was disappointed with our performance when we were losing 3-1 but I think that was the biggest merit for our team - we never gave up, we tried to continue, we kept working, playing and we scored three goals.
We were a little bit lucky as there was as moment in our box when two of their players missed a chance, or it would have been 4-3 to them. So I think that bit of luck, and our reaction to going 3-1 down, the character of the team was, that was important.
Jan Siewert: I have thousands of thoughts I would say. Since the last game I worked 24 hours a day to work out a match plan for this game. How we can score and win this game - we came here to win.
They showed that they got it at 3-1 and it's hard to describe this result at the end.
Opta stats
West Ham have won three consecutive Premier League games at the London Stadium for the very first time.
- This was just the third time in Premier League history West Ham have come from 2+ goals behind to win, also doing so against Bradford in February 2000 (5-4) and Everton in March 2016 (3-2).
- This was just the eighth time Huddersfield have scored more than one goal in a Premier League game, but the first they've not gone on to win (W7 D0 L1).
- West Ham are unbeaten in 17 Premier League games in which they've scored a goal (W12 D5) since a 1-3 defeat at Arsenal in August.
- Huddersfield scored as many goals against West Ham this afternoon as they had in their previous 11 Premier League games combined.
- All 52 of West Ham striker Javier Hernandez's Premier League goals have been scored from inside the box.
- Javier Hernandez today became the first West Ham player to score two headed goals in a Premier League match since Michail Antonio against Watford in September 2016.
- Mark Noble became only the third player to score 40 Premier League goals for West Ham, after Paolo Di Canio (47) and Carlton Cole (41).
Man of the match - Javier Hernandez
After being dropped from the starting line-up, Hernandez was given the unenviable task of coming off the bench with his side trailing 2-1. He then saw them go 3-1 down before he had a chance in front of goal, only to end up as the match-winner.
Despite being the shortest player on the pitch, Hernandez twice found the back of the net with headers in the 84th and 91st minute to hand West Ham a memorable comeback victory.
What's next?
West Ham host Everton in a Saturday evening kick off two weeks today, while Huddersfield have another trip to the capital to take on Crystal Palace.