John Mousinho's first goal for Gillingham gave them a crucial victory at the expense of his former club Stevenage.
The on-loan Preston midfielder latched onto Danny Hollands' free-kick to head past Chris Day 14 minutes from time.
Midfielder Simon Heslop had earlier scored his first goal for Stevenage with a low 20-yard drive eight minutes before the break to give the visitors a deserved half-time lead.
Gills striker Danny Kedwell levelled the game two minutes after the break, scoring his fifth penalty of the season following Jon Ashton's clumsy foul on Mousinho.
Defender Donervorn Daniels put the hosts ahead on his debut five minutes later, as the West Brom loanee slid to fire Craig Fagan's curling cross past Day.
Francois Zoko levelled the scores on the hour mark as Stevenage's top scorer got the final touch on team-mate Filipe Morais' goal-bound header.
After Mousinho put the hosts in front for the second time, former Gillingham player Luke Freeman wasted the visitors' best chance to earn his team a point as he blazed a shot over from close range.
Gills captain Adam Barrett also submitted his contender for miss of the season as he somehow shot over from two yards when faced with an open goal after just nine minutes.