Everything looked to be going to plan for Darren Ferguson’s men as Britt Assombalonga, Tommy Rowe and Lee Tomlin scored before half-time.
Oldham pulled two back through Gary Harkins and David Worrall within nine minutes of the second period starting, but a 63rd-minute goal from Nicky Ajose put Peterborough back in charge before they ultimately capitulated.
James Wesolowski made it 4-3 and Harkins grabbed his second from the penalty spot to level the scores in the 89th minute, after Tomlin had been sent off for handling on the line.
Genserix Kusunga completed the turnaround in stoppage-time to earn a sensational win for Oldham.
Walsall also hit five goals on Saturday in a 5-1 triumph at Notts County.
A first-half hat-trick from former Manchester United youngster Febian Brandy put the visitors well on their way to victory.
Andy Butler and Craig Westcarr added further goals for Dean Smith’s side early in the second half, with Callum McGregor's subsequent reply no more than a consolation.
County are just one point above the relegation zone, while Walsall move into the play-off places.
Wolves remain in touch with the top two thanks to a comfortable 3-1 win over visiting Bristol City, who stay second-from-bottom.
Nouha Dicko scored goals either side of Sam Baldock's penalty for City and Bakary Sako's 76th-minute strike sealed the win, keeping Wolves in third, two points behind Leyton Orient.
Rotherham United stay in the top six despite dropping points at home courtesy of a 2-2 draw with Crawley Town.
The visitors looked set to take all three points, but Kieran Agard registered his second of the game in the 90th minute to salvage a point for Rotherham.
Struggling Shrewsbury Town remain in deep trouble following a 3-1 defeat at Swindon Town, but Tranmere Rovers climbed up to 17th by beating another relegation-threatened side, Crewe Alexandra, 1-0.
Get the best features, fun and footballing frolics straight to your inbox every week.
Thank you for signing up to Four Four Two. You will receive a verification email shortly.
There was a problem. Please refresh the page and try again.