Two goals in the last seven minutes from Sam Parkin and James Milner moved Swindon up to second in Division Two and condemned Peterborough to their first away defeat of the season.
Parkin made the breakthrough after 84 minutes when he headed home Andy Gurney's cross from the left for his eighth goal of the season.
Milner, on loan from Leeds, added a second deep into injury-time, firing home from 12 yards as Swindon extended their unbeaten league run to nine matches.
Parkin's strike partner Tommy Mooney also headed against a post and had a shot cleared off the line.
Swindon goalkeeper Rhys Evans did well to deny Peterborough strikers Andy Clarke and Leon McKenzie, while substitute David Farrell thumped a 25-yard shot against the crossbar.
Swindon: Evans, Ifil, Viveash, Heywood, Miglioranzi, Igoe, Gurney, Hewlett, Milner, Mooney, Parkin. Subs: Griemink, Grant Smith, Stevenson, Howard, Reeves.
Peterborough: Tyler, Kanu, Burton, Rea, Arber, Legg, Wood, Gill, Thomson, Clarke, McKenzie. Subs: Farrell, Newton, Boucaud,
Logan, Pearce.
Referee: C Boyeson (E Yorkshire)