Rotherham United paid the price for a dismal second-half performance as they were knocked out of the FA Cup by Crewe Alexandra.
The League One Millers had led 1-0 after bossing proceedings in the first half at Gresty Road, but their opponents from a division lower hit back with two goals after the break to win the first-round tie.
It was late agony for Paul Warne's men as the game-clinching goal came in the 89th minute.
A low-key opening period controlled with some ease by the Millers was lit up by a moment of quality in the 21st minute.
Will Vaulks took possession more than 20 yards out and curled a beautiful shot into the net before celebrating with his trademark somersault.
Top scorer Kieffer Moore looked to have headed Rotherham 2-0 ahead on the stroke of half-time from Joe Newell's corner but, after consulting with a linesman, the referee ruled that the flag-kick should be retaken.
Having dominated proceedings, the Millers were pegged back two minutes after the break when goalkeeper Richard O'Donnell dithered over whether to come for George Cooper's free-kick and Brad Walker glanced his header home.
Then Callum Ainley was on hand in the dying stages to steer the ball past O'Donnell to complete Rotherham's misery.
A Vaulks free-kick piledriver had clipped the bar just after the hour mark, but the home side were doing most of the pressing and Ng shot just over.
Moore was close to scoring in the 73rd minute, his deft header from Jon Taylor's supply bringing a smart save out of Dave Richards.
However, that was the end of their attacking threat, leaving Crewe, managed by Millers old boy David Artell, to grab the glory.
Goals: Walker 47, Ainley 89 (Crewe); Vaulks 21 (Rotherham).
Crewe (4-3-3): Richards; Ng, Raynes,Walker, Pickering; Lowery, Grant, Ainley; Cooper, Bowery (Porter 74), Dagnall. Subs not used: Garratt, Bakayogo, Nolan, Kirk, Reilly, Stubbs.
Rotherham (4-2-3-1): O'Donnell; Cummings, Ajayi, Wood (Ihiekwe 83), Emmanuel; Potter, Vaulks; Williams (Taylor 61), Ball (Towell 68), Newell; Moore. Subs not used: Rodak, Forde, Clarke-Harris, Yates.
Referee: Scott Oldham (Lancashire).
Attendance: 2,597 (603).