Ten-man Rotherham United were on the end of a FA Cup humbling as League Two Rochdale came from behind to claim victory.
The Millers led after five minutes through Lee Frecklington and should have had the tie sewn up in the opening 20 minutes as danger man Kieran Agard spurned two good chances.
But Rochdale became a much stronger proposition when manager Keith Hill switched to four at the back and a diamond midfield.
They hit back to level 10 minutes into the second half when Matthew Lund chested home Matthew Rose’s deep cross.
Rotherham were reduced to 10 men 17 minutes from time when referee George Scott dismissed Michael Tidser for a second bookable offence.
Scott bore the wrath of the New York Stadium regulars for a patchy display, and the winner was scored by a man who should have been sent off.
Peter Vincenti appeared to go in high over the ball on Tidser midway through the second half and got away without a booking.
He then popped up at the back post to steer Joe Bunney’s left-wing cross home eight minutes from time to send the League Two side into the hat for the third round.
The performance of referee George Scott left Millers boss Steve Evans raging.
Evans said: “I’m not allowed to say he was absolutely rubbish because I’d be in trouble.
“I’ve never seen a manager as happy with a set of match officials and if I was Keith Hill I’d be laughing too.
“There’s no doubt it’s a foul on Mark Bradley in the lead up to the second goal, he was pushed, but it didn’t surprise me that we didn’t get it.
“My players are upset in the dressing room, they’ve said some things they’d never say to a match official but we’ll make our report through the appropriate people in charge.
“If any player turned up and played like that they wouldn’t be in the team next week. I’m not questioning his integrity, he’s an honest guy, but I’ve never seen an honest guy have as bad a game as that, he was absolutely shocking from start to finish.
“But the reason we’ve lost is a couple of individual errors, and I want to make absolutely clear that we don’t blame the referee. They scored two goals and we scored one, and we’re out of the Cup.”