Dany N'Guessan's injury time strike sealed a great second half comeback for Lincoln City to end Gillingham's winning run.
Simeon Jackson's penalty put the home side deservedly ahead at the break, but the Imps hit back through a wonder goal from Geoff Horsfield early in the second half. A draw was probably a fair result, but N'Guessan took advantage of a tiring Gills defence to sprint through and net a 91st-minute winner.
Gills went into the game in a season-high fourth position and looking for a fourth successive victory. They began like a side oozing with confidence, with Dennis Oli and Nicky Southall both coming close to scoring early on.
Despite playing on a heavy pitch they moved the ball around well and a high quality passing move led to Frank Sinclair bundling Adam Miller over as the Gills skipper lined up a shot eight yards out. The referee immediately awarded a penalty, which Simeon Jackson converted for his 14th goal of the season.
Lincoln fought hard to stay in the game and seven minutes after the break conjured an equaliser out of nothing.
Horsfield, who briefly retired earlier this season after being diagnosed with testicular cancer, swivelled 25 yards out and smashed a shot in off the crossbar. It was the 35-year-old striker's first goal since August 2007, but it was well worth the wait.
Gills went in search of a second goal but gave the ball away far too often as the Priestfield surface cut up. The hosts visibly drained late on as their efforts came to nothing and they were left stunned by N'Guessan's late goal.
The forward, who scored a long-range effort when the sides met in October, raced on to a through-ball, shrugged off a challenge from Stuart Lewis and rounded Simon Royce to tap into an empty net.