They leapfrog MK Dons, who were beaten 3-2 at Bristol City, while Swindon also climb above the Dons after three second-half goals from Nathan Byrne, Jake Reeves and Andy Williams ensured the Robins comfortably beat Barnsley at Oakwell.
Preston also moved into a congested playoff picture as Joe Garner's penalty sealed a 2-0 win away at Coventry City.
Sheffield United looked to be heading for defeat at Bramall Lane when Luke Norris fired Gillingham ahead in the 83rd minute.
Oldham Athletic also needed a late show to beat Scunthorpe United, with Danny Philliskirk scoring twice in a 3-2 win at Boundary Park.
The Latics are part of a chasing pack of seven clubs separated by two points and Chesterfield kept themselves in touch with the league's high-flyers when they came from behind to earn a draw against Notts County, with Austrian defender Georg Margreitter the hero for the Spireites.
Bradford City also remain in the top half of the table after Mark Yeates scored a valuable equaliser against a Port Vale side who had taken the lead through Chris Lines's penalty earlier in proceedings.
Anthony Forde's second-half strike sealed a comfortable victory for Walsall, who beat fellow strugglers Doncaster Rovers at the Bescot Stadium.
In another game between two potential relegation contenders, Colchester United registered a thumping victory over bottom-of-the-table Crewe Alexandra at Gresty Road as Freddie Sears, Rhys Healey and Sanchez Watt netted in the second half for the Essex outfit. The result sees United move out of the bottom four.
Elsewhere, Crawley Town leapfrogged Yeovil Town in the table after Marvin Elliott scored twice in as many minutes to ensure victory.
Results in full: Barnsley 0-3 Swindon Town, Bradford City 1-1 Port Vale, Bristol City 3-2 MK Dons, Chesterfield 1-1 Notts County, Coventry City 0-2 Preston NE, Crawley Town 2-0 Yeovil Town, Crewe Alexandra 0-3 Colchester United, Leyton Orient 2-3 Rochdale, Oldham Athletic 3-2 Scunthorpe United, Peterborough United 1-0 Fleetwood Town, Sheffield Utd 2-1 Gillingham, Walsall 3-0 Doncaster Rovers