Rotherham United suffered last-gasp heartache as manager Paul Warne lost the battle of the former teammates at AESSEAL New York Stadium.
The Millers were pressing for a winner in time added on against 10-man Shrewsbury, but the visitors broke away, won a corner and Stefan Payne settled the contest in the 93rd minute in favour of the League One leaders with a close-range shot.
It earned Shrews boss Paul Hurst bragging rights over the man he used to share a dressing room with when he and Warne were Rotherham players.
Rotherham were nowhere near their best but had dominated the second half after the 53rd-minute dismissal of Shrews captain Abu Ogogo.
They should have taken an early lead when they were awarded a 12th-minute penalty as Richie Towell was barged over in the box by Aristote Nsiala.
Kieffer Moore, the country's 13-goal leading scorer, stepped up to take it but Shrews keeper Dean Henderson dived to his left to pull off a good save.
The Millers were made to pay four minutes later when Jon Nolan latched on to the ball on the left and drove a shot across Richard O'Donnell to put Hurst's side ahead.
The Shrews were reduced to 10 men in the 53rd minute when Abu Ogogo was deservedly sent off for an over-the-ball challenge on Shaun Cummings.
Rotherham made their numerical advantage tell on 76 minutes when Joe Newell crossed and a defensive header dropped to Towell who never looked like missing as he volleyed home from just inside the area.
It set up a grandstand finish but the Millers, as they went after all three points, were hit by Payne's agonising sucker-punch.
Goals: Nolan 16, Payne 90+3 (Shrewsbury); Towell 76 (Rotherham).
Rotherham (4-1-4-1): O'Donnell; Cummings (Clarke-Harris 60), Ajayi, Wood (Frecklington 72), Mattock; Potter; Williams (Forde 82), Vaulks, Towell, Newell; Moore. Subs not used: Rodak, Emmanuel, Ball, Wiles.
Shrewsbury (4-1-4-1): Henderson; Riley, Nsiala, Beckles, Sadler; Godfrey; Whalley (John-Lewis 90+4), Nolan, Ogogo, Rodman (C Morris 77); Payne. Subs not used: MacGillivray, Dodds, Gnahoua, Bolton, B Morris.
Referee: Robert Jones (Merseyside).
Attendance: 8,184 (699).