Wroe kept his nerve to smash an 82nd-minute penalty past Conrad Logan after Johnny Mullins bundled Marvin Morgan to the ground.
Rotherham had earlier broken the deadlock from a 42nd-minute penalty, Lewis Grabban coolly sending Chris Neal the wrong way from the spot for his 13th goal of the season after Matt Richards brought down Sam Wood.
But Rotherham’s joy quickly turned to despair on the stroke of half time when right-back Marcus Marshall was dismissed for a second bookable offence, a foul on Mark Wright.
Shrewsbury needed just three minutes of the second half to make their extra man count, former Rotherham skipper Ian Sharps turning in his first goal of the season from close range after Logan failed to claim a corner from Wright.
Logan then pulled off a string of fine saves to frustrate Shrewsbury before Wroe’s penalty proved decisive to send Graham Turner’s men into the third round for the first time in eight years.