Rotherham's Iceland international defender Kari Arnason handled in the area and Grant McCann scored the winner from the penalty spot.
It was an impressive response by the visitors after a half-time rocket from manager Darren Ferguson following their sloppy first-half display.
In the opening 45 minutes Rotherham had the lion's share of the chances but failed to make the most of them and after the goal the home side produced a spirited rally but fell short of an equaliser.
Kieran Agard, Ben Pringle, Rob Milsom and Darniel Nardiello all went close in the first half and Britt Assombalonga might have grabbed the lead for the visitors.
But Peterborough were gifted the winner when Arnason flapped his hand at McCann's corner and the Northern Ireland international smashed home the resulting penalty himself.
Mark Bradley blazed wide, Milsom went close, Pringle headed over and Joe Skarz could have done better as the Millers were denied in their hunt for a leveller.
Source: PA
Source: PA