Three goals in nine second-half minutes saw Rotherham United book their spot in the second round of the FA Cup at non-league Maidenhead United.
The Millers trailed until the 69th minute after Jake Cassidy had given the home side a shock lead midway through the first half.
Maidenhead played 35 minutes with 10 men after Aaron Massey was shown the red card for a rash tackle on Ben Wiles.
Michael Ihiekwe got the away side back on terms 15 minutes after the sending off before Freddie Ladapo put the Millers ahead six minutes later.
Victory, and a place in the second-round draw, was sealed three minutes later through Matt Crooks's strike.
Earlier, Cassidy had latched onto a pass over the top before striking the ball into the bottom corner on 25 minutes.
The Millers almost got back on terms just before the interval but Wiles was denied by the Maidenhead keeper, who got down quickly to deny him from close range.
Then came the turning point, as Massey was shown a straight red card for a reckless challenge on Wiles.
Ihiekwe dragged Rotherham level as he found the bottom corner to equalise.
And the Millers were ahead with 15 minutes to go as Ladapo fired the ball into the corner of the net with a beautiful strike.
Maidenhead's hopes of finding an equaliser and forcing a reply were dashed three minutes later as Jake Hastie got beyond the hosts' defence and found Crooks to finish from close range.
Rotherham controlled the final 10 minutes of the contest and almost added a fourth but Wiles's long-range strike hit the crossbar.