Gills central defender Brent Sancho opened his account for the club with the winner against Chesterfield.
The Trinidad and Tobago international left it until four minutes from full time before glancing a header past the despairing Barry Roche in the Chesterfield goal.
The first chance at Priestfield was witnessed on four minutes when Gareth Davies brought down Matt Jarvis and Darren Byfield curled the resulting free kick straight into Roche's arms.
Chesterfield's first attack was on nine minutes, but they didn't threaten Jason Brown in the Gillingham goal as Derek Niven sliced wildly wide of the intended target.
Gillingham were a whisker away from breaking the deadlock on 25 minutes when Tom Williams launched a long throw into the box from the left, Andrew Crofts rose highest and his powerful header was superbly tipped over by Roche.
Roche was involved once again as he parried Sancho's header onto the post, following a Williams corner, and the best chance of the half then arrived in the 30th minute. Neil Harris picked out Andy Hessenthaler's run, he took it in his stride, waltzed past Reuben Hazell and appeared destined to score until Roche got his hand to it.
Colin Larkin then looked threatening for Chesterfield in the box, but Leon Johnson's challenge halted him in his tracks and the sides went in level at the break.
On the hour mark Paul Hall nutmegged Williams, but couldn't pick out a cross from a dangerous position and he later shot straight at Jason Brown.
Eight minutes later Gills substitute Steven Hislop, who had replaced the injured Darren Byfield at half time, presented Hessenthaler with a crossing opportunity from the right, he whipped one in and Crofts got himself on the end of it, but could only direct his header wide of the post.
Williams then took a corner from the right, it reached the back post and Sancho headed it back across goal. Chesterfield only half cleared their lines and Hessenthaler shot straight at Roche.
A minute later Hessenthaler turned provider as he played in Harris and a sublime piece of skill completely deceived Steve Blatherwick as he guided the ball over his head before unleashing a stunning half volley which was equally well saved by Roche.
Chesterfield then went on the break through their captain Mark Allott, he played the ball into Caleb Folan whose shot on the turn was never going to trouble Brown.
The game seemed to have 0-0 written all over it, although Gillingham had other ideas and in the 86th minute Sancho glanced a header, from Hislop's inch perfect right wing cross, to spark celebratory scenes at Priestfield.
Gillingham: Brown, Rose, Williams, Crofts, Johnson, Sancho, Hessenthaler (Jackman 83), Flynn, Byfield (Hislop 45), Harris, Jarvis.
Subs not used: Knowles, Corneille, Scaramozzino.
Chesterfield: Roche, Davies, O'Hare, Niven, Hazell, Blatherwick, Hall (Hurst 89), Clingan, Larkin, Folan (DeBolla 89), Allott.
Subs not used: Muggleton, Kovacs, Picken.
Bookings: Hall (Chesterfield)
Referee: Mr Jarnail Singh