Javier Hernandez came off the bench to score two late goals as West Ham recovered to beat Premier League bottom club Huddersfield 4-3 at the London Stadium.
Michail Antonio had seen a header clip the crossbar before Irons captain Mark Noble put the hosts ahead from the penalty spot in the 15th minute.
The lead, though, was short lived as Juninho Bacuna equalised with a header from a corner just two minutes later.
Huddersfield turned the match around when Karlan Grant made it 2-1 on the half-hour following a well-worked short free-kick.
And Terriers forward Grant scored his second of the match with a shot into the top corner in the 65th minute.
Angelo Ogbonna pulled a goal back for the Irons with a header from a corner in the 75th minute.
Hernandez then made it 3-3 with six minutes left, heading in a cross from fellow substitute Samir Nasri.
And with the 90 minutes up, the Mexico forward completed a remarkable recovery when he nodded in a chip from Felipe Anderson.
Elsewhere, Leicester overcame the early dismissal of Harry Maguire to win 2-1 at Burnley with a stoppage-time goal from Wes Morgan.
England defender Maguire was shown a straight red card in the fourth minute after tripping Johann Berg Gudmundsson as the Burnley midfielder broke clear.
James Maddison, though, put the Foxes ahead in the 33rd minute with a fine free-kick past Tom Heaton.
Teenager Dwight McNeil equalised for Burnley in the 38th minute after being picked out by Charlie Taylor.
Defender Morgan, who had been sent on to fill the gap by Maguire’s dismissal, snatched a dramatic winner for the away side when he got on the end of a deflected cross from Youri Tielemans.
There was also late drama at Bournemouth, where Newcastle fought back to earn a 2-2 draw after Matt Ritchie scored a superb volley deep into added time.
Ryan Fraser saw an early effort hit the outside of the post, but it was the visitors who broke the deadlock moments before half-time through a curling free-kick from Salomon Rondon.
The home side were back on level terms soon after the restart when Joshua King converted a penalty in the 48th minute after Nathan Ake had been brought down by Federico Fernandez.
King got his second of the afternoon in the 81st minute from a pass by Dominic Solanke, which looked to have secured Bournemouth all three points.
Newcastle, though, earned themselves a share of the spoils following Ritchie’s fine finish from a cross by DeAndre Yedlin.