Port Vale moved to the top of League Two with a win at Dagenham & Redbridge.
Vale were ahead within the opening five minutes when Daggers goalkeeper Chris Lewington failed to claim a long throw and Tom Pope headed into an empty net.
Jennison Myrie-Williams doubled the lead with a low shot but Sam Williams replied from the penalty spot.
Louis Dodds ran on to a long clearance and lobbed Lewington to make it 3-1 just before half-time but a strike from Scott Doe set up a nervy finale.
Gillingham had been top of the table since the start of September but Vale were handed the chance to leapfrog them after the Gills' game at home to Northampton was postponed because of a waterlogged pitch.