Kyle Dempsey scored a first-half winner as Gillingham overcame in-form Accrington 1-0 in Sky Bet League One.
The Gills had lost five of their last six league games and Stanley had moved into the play-off spots after one loss in their last 11 but it was Steve Evans’ side who got revenge for a 2-0 defeat in mid-December.
Gillingham were the main threat in the first half with Alex MacDonald forcing two good saves out of Nathan Baxter.
The visitors took the lead one minute into added time as Jordan Graham crossed from the left and MacDonald set up captain Dempsey, who curled the ball home from the edge of the area.
Stanley responded three minutes after the break when a Sean McConville corner found Michael Nottingham but his header thumped against the crossbar.
The Gills continued to threaten, with Baxter pushing away another Dempsey long-range strike, while Jack Bonham superbly denied Colby Bishop an equaliser from close range in the 90th minute.