Jay Emmanuel-Thomas scored two second-half penalties as Gillingham came from behind to shatter Chesterfield with a stoppage-time equaliser to secure a 3-3 draw at the Proact Stadium.
Gillingham were caught cold in the second minute when Jon Nolan whipped in a free-kick from the right and Conor Wilkinson headed in from eight yards.
Chesterfield were causing problems down the flanks but Gillingham created little until the 32nd minute when Jay Emmannuel-Thomas was denied from 10 yards by Tom Anderson’s block.
The visitors went further behind in the 52nd minute after Mark Byrne tripped Nolan and Dennis fired the spot-kick past Stuart Nelson’s right hand.
Emmanuel-Thomas pulled one back with a 65th-minute penalty after Deji Oshilaja was pulled back by Anderson but Wilkinson lifted the ball over Nelson in the 72nd minute to make it 3-1.
Emmanuel-Thomas netted a second penalty after Scott Wagstaff was tripped by Laurence Maguire put Gillingham back in it and Scott Wagstaff tapped in four minutes into added time to complete the comeback.
The result sees The Gills stay 8th in League One, just two points outside the play-off places with a trip to AFC Wimbledon next on Saturday afternoon.
Chesterfield line up: Fulton, Graham, Maguire (Donohue 86), Hird, Anderson, Ariyibi, Mitchell (O’Shea 62), Nolan, Liddle, Dennis, Wilkinson (Dimaio 77).
Subs not used: Evatt, Gardner, German, Parkin.
Goals: Wilkinson (2), (72), Dennis (52).
Booked: Wilkinson (43), Anderson (64), Dennis (90).
Gillingham line up: Nelson, Osadebe, Wagstaff, Ehmer, Oshilaja, Pask, Knott (List 59), Byrne, Oldaker, Dack, Emmanuel-Thomas.
Subs not used: Hadler, Wright, Dickenson, Hessenthaler, Chapman, McDonald.
Goals: Emmanuel-Thomas (65 pen), (76 pen), Wagstaff (96).
Booked: Knott (49), Oldaker (90).
Referee: Mr Trevor Kettle.
Assistants: Mr Peter Gooch & Mr Duncan Street.
Attendance: 4,714 (124 Gills)