Substitute Omari Hutchinson struck the winner at the death as Ipswich boosted their Championship automatic-promotion hopes with a 4-3 win over bottom-placed Rotherham.
Hutchinson's effort in the sixth minute of added time after Cafu's levelling penalty moments earlier left the Tractor Boys behind second-placed Leeds only on goal difference, with Southampton losing to Hull.
Town initially fell behind after just two minutes through Tom Eaves, but responded thanks to a Keiffer Moore strike and Wes Burns' first-half brace.
Hakeem Odoffin pulled one back for the Millers in the second half before the nail-biting additional time.
The visitors got off to the perfect start through Eaves.
Ipswich defender Harry Clarke had a chance to clear from Town's penalty box but Sam Clucas stuck out a foot and toed the ball into the path of the Millers striker who guided his shot beyond the reach of goalkeeper Vaclav Hladky.
But Town struck back eight minutes later through Burns.
Sam Morsy swept forward into the Rotherham penalty area and his cross was firmly headed home by the winger.
Ipswich's dominance after conceding an early goal paid off in the 14th minute when Moore put them in front, notching his fourth goal in five games following his arrival on loan from Bournemouth.
It came from a wonderful run down the right by Burns who swept past Lee Peltier. His pinpoint cross found the unmarked Wales international striker who side-footed home on the run and into the far left corner of the net.
Burns got his second goal to put Town further ahead in the 29th minute.
Conor Chaplin played him in down the right and his initial shot was parried out by Viktor Johansson but fell to raiding full-back Leif Davis whose shot found Burns and he stabbed home from close range.
There was a lengthy delay when Rotherham midfielder Ollie Rathbone crashed into the advertising boards following a challenge with Jeremy Sarmiento and was stretchered off on the medical cart to be replaced by Femi Seriki.
Burns almost completed a hat-trick when he headed narrowly wide of the Rotherham left-hand post but the visitors pulled a goal back through Odoffin.
Hladky failed to punch the ball clear when challenged in the six-yard box and it fell to the Rotherham central defender who coolly slotted the ball into the empty net.
United pressed for an equaliser and Sam Nombe struck the post but they equalised in added on time with a penalty by substitute Cafu, only for Hutchinson to secure the three points with a stunning strike past Johansson to raise the roof of Portman Road.