Deon Burton's 22nd-minute goal was the only difference between the two sides as Gillingham moved closer to automatic promotion after second-placed Port Vale dropped points at Chesterfield and Northampton were beaten by Cheltenham.
Vale, however, will be thankful to have taken any points away from Chesterfield as Tom Pope conjured a late equaliser to claim a 2-2 draw. Vale had taken the lead through Darren Purse in the fifth minute but Chesterfield hit back twice thanks to a double from Marc Richards who seemed to relish playing against his former club.
Steve Elliott's first-half effort was enough for Cheltenham to beat Northampton 1-0, while Burton missed the chance to move into third place when James Beattie scored a last-minute equaliser for Accrington as the sides played out a hard-fought 3-3 draw. Accrington took an early lead through Will Hatfield before Matthew Paterson cancelled it out before half-time.
The home side again took the lead after the break though Padraig Amond but it only lasted for six minutes as again Burton levelled, this time thanks to Zander Diamond. Jacques Maghoma's 35-yard free-kick edged Burton ahead for the first time in the game in the 73rd minute and they looked on course to win, but Beattie had the final word with an equaliser in the third minute of stoppage time.
At the other end of the table, York sealed a much-needed 2-0 win over Plymouth to move just one point away from safety. The victory was York's first in 17 games and manager Nigel Worthington's maiden win, with Ashley Chambers firing their first before Richard Cresswell added the second within half an hour on his return to the club he left 14 years ago.
Bottom side Aldershot also secured a valuable 3-2 win over 10-man Oxford thanks to substitute Jeff Goulding, who scored a late winner. Aldershot had squandered a two-goal lead, given to them by Paul McCallum's early strike and Craig Reid's penalty just after half-time. Scott Davis' free-kick and Jon-Paul Pitman's strike looked to have ruined the Shots' day, but after Michael Raynes' second yellow card Goulding hit an 87th-minute winner.
Bradford kept their play-off hopes alive at the expense of struggling Torquay as they won 3-1. On-loan Joss Labadie put Torquay in front in the third minute but Rory McArdle and Garry Thompson soon put Bradford ahead, with James Hanson netting the third just after the break. Two late goals for Rochdale spoiled Exeter's day as they lost 2-1 at home. Jamie Cureton gave Exeter the lead in first-half injury-time, only for Ian Henderson and Bobby Grant to score in the dying minutes.
Bristol Rovers beat Dagenham and Redbridge 4-2. John-Joe O'Toole and Oumare Tounkara gave Rovers a 2-0 lead within six minutes, with Danny Woodards adding the third midway through the first half. Ben Strevens pulled one back for Dag and Red before the break before Tounkara scored again in the 70th minute. Jake Reed's close-range strike for the home side kept the game alive but it was the last score of the eventful match.
Elsewhere, Stuart Lewis's second-half goal saw Wycombe beat Morecambe 1-0 while Keanu Marsh-Brown's late score was enough for Barnet to beat fellow strugglers Wimbledon 1-0.