Former Rotherham striker Richie Barker came back to haunt his old club and put Mansfield through with an injury time winner.
Barker, who switched clubs a year ago, was on target 15 minutes from the end to equalise after the home side looked set to go through then he came up with the last minute killer as both side's finished with 10 men.
Paul McLaren twice levelled for Rotherham and then Deon Burton gave the home side the lead before Barker strike in 75 minutes.
Mansfield set the tie alight rocking the League One side with a goal to claim the lead after 27 minutes.
Rotherham cleared a free kick into the area but Gus Uhlenbeek picked up the loose ball and swung his cross into the danger area and Simon Brown stole in at the near post to glance in a neat header.
The lead lasted three minutes before Rotherham were back level. The ball pinballed around the area after the home side pushed forward and when it dropped for Paul McLaren the midfielder hooked a stunning shot on the turn to beat Pressman.
Butler was fortunate to escape with a yellow card a minute later when Stephen Dawson went down under an aerial challenge from the home striker.
Eight minutes before half time the visitors were back in front when Giles Coke powered a header goal wards after David Worrell headed out a dangerous ball.
Rotherham keeper Gary Montgomery lost the flight of the ball and it drifted past him despite home protests that Richie Barker had a last touch from an offside position.
This time Rotherham hit back within a minute before half time. McLaren played a neat build up with Burton and then unleashed a fierce drive from 18 yards ramming his shot into the top corner.
Burton claimed his 10th of the season eight minutes after the restart when he drifted in unmarked to slot in a close range after Michael Keane's corner dropped behind the defence.
Brown wasted a glorious chance to level for Mansfield when a cross was headed down but he scooped his shot over from a yard out
But after 75 minutes Barker gave his side a second chance when he drilled in a low shot from eight yards after Adam Burchall's low cross from the right.
Mansfield's Gus Uhlenbeek and Rotherham's Michael Keane were red carded after clashing in the last minute,
And then in injury time Barker struck again smashing in his shot from close range.