Ipswich Town scored a dramatic 95th-minute winner to deny bottom side Rotherham United a point and move up to third in the Championship table.
Home substitute Omari Hutchinson drilled in to snatch all three points, after Rotherham had come back from two goals down to equalise in stoppage time.
Tom Eaves’ calm finish gave the Millers a surprise early lead, only for Wes Burns to score either side of Kieffer Moore’s effort.
Having gone 3-1 down, Rotherham thought they had rescued a draw through Hakeem Odoffin’s strike and Cafu’s penalty before Hutchinson’s late intervention.
The win moved Ipswich, who host Birmingham next on Saturday, level on points with second-placed Leeds but with an inferior goal difference.
Rotherham stunned the home crowd by finding the net with the first chance of the game.
Sam Clucas got his toe to the ball in midfield and poked it through for Eaves, who showed great composure to find the bottom corner.
The advantage lasted seven minutes before Sam Morsy’s floated cross from the left found Burns, who headed home from close range.
Kieran McKenna’s Ipswich then seemed to kick into action, with Burns whipping in a dangerous cross from the right and Moore getting great contact on the ball to steer it in.
Burns also had a hand in creating his second goal. His initial shot was palmed away by Rotherham goalkeeper Viktor Johansson, who did the same with left-back Leif Davis’ follow-up, leaving winger Burns to tap into an empty net.
The Millers did not give up hope though, and Odoffin drove in a low volley to reduce the deficit to one goal after the home defence failed to deal with Clucas’ ball into the penalty area.
Ipswich looked the more likely side to score as Burns produced a smart reaction save from Johansson, before the late drama at Portman Road.
Cafu chipped in a Panenka penalty to make it 3-3 in the 94th minute, yet Rotherham allowed Hutchinson time and space to curl in a neat left-footed finish and win the game for Ipswich in the most dramatic fashion.
Rotherham have now lost 20 Championship games this season and go to fellow strugglers QPR on Saturday, knowing they have seven away games left to avoid going a whole league season without a win on their travels.
The last team to achieve that unwanted feat was Rotherham themselves in the 2016-17 season in which they scored 23 points, four more than their current total.
Ipswich Town manager Kieran McKenna told:
“It was a bit of a wild night from the first minute. We never managed to get the control or composure in the game that we wanted.
“We made some mistakes, but we scored four goals at home and we won a game in the Championship.
“We have got some lessons to learn, but we have come out on the right side of the result.
“Rotherham came here and they played like they don’t have too much to lose. They made it really difficult. We just got drawn into the type of game that they wanted it to be.”
Rotherham United manager Leam Richardson said:
“You saw the good, the bad and the ugly of what we are and why we are in the position we are in.
“I’m disappointed for the players who worked terrifically hard. We started the game very well, we had a crazy 10 minutes.
“The first goal hurt us. We never really recovered from it, it was like a dazed boxer, but the last hour we probably deserved something from the game.
“I don’t think many teams come here and dominate all the stats and score three goals and not win the game, so [I’m] disappointed for the players.”