Bradley Dack’s second half strike clinched maximum points for the Gills on Saturday.
Gillingham had gone 2-0 up inside 14 minutes of the League 1 encounter with John Marquis scoring both.
Oldham levelled through Liam Kelly and Dominic Poleon only for Dack to win it for the Gills.
Victory took the Gills up to 16th in the table.
Both teams were unchanged for Saturday’s match after registering wins the previous week.
Gills’ caretaker management team were taking charge for the fifth time and went into Saturday’s game boosted by the win over Coventry last time around.
The game was just over six minutes old when Marquis netted the first of his goals, latching onto a pass from Cody McDonald, beating defender George Elokobi for pace and then guiding the ball past keeper Paul Rachubka.
It was 2-0 after 14 minutes and Marquis again finished with a low strike. That goal came after a mistake from defender James Wilson which Bradley Dack made the most of, before feeding the Gillingham no.9.
Just five minutes later Oldham were right back in the game, as Dack fouled Connor Brown for a penalty. Keeper Stuart Nelson made a good one-handed save from Danny Philliskirk but Oldham captain Kelly reacted quickest and turned the loose ball home.
The scores were level after 22 minutes when Nelson miss-kicked a back-pass from Bradley Garmston. The ball ran into Poleon’s path and he managed to round the Gills keeper to make it 2-2.
There were good chances for both teams before the break to score a third.
Bradley Pritchard forced a good save from Rachubka, with a 20-yard strike, while Mike Jones should have done better for Oldham when he shot unmarked. Nelson saved with his feet.
The half ended with Oldham’s James Wilson thankful to a lenient referee after raising his hands to Marquis. The Oldham player got away with a yellow card.
Max Ehmer had a second half block for the Gills while at the other end McDonald had to clear off the line from Amari Morgan-Smith.
With the scores still level, Gills’ management introduced Jermaine McGlashan, in the hope he would have the same match-winning impact as the week before.
He won a corner within seconds of coming on and soon afterwards Gills retook the lead. Dack found the top corner with 20 minutes left, courtesy of a deflection, which sent the shot out of the reach of the keeper.
Oldham sub Jacob Mellis lashed a chance wide with 10 minutes left while a good save from Rachubka, racing out to deny McDonald, kept it at 3-2.
Gillingham: Nelson, Hoyte, Garmston (Dickenson 68mins), Egan, Ehmer, Loft, Pritchard, Dack, Hessenthaler (McGlashan 68mins), Marquis (Martin 90mins), McDonald. Subs not used: Legge, G Morris, Galbraith, Norris.
Oldham: Rachubka, B.Wilson, J.Wilson, Elokobi, Brown, Kelly, Jones, Winchester (Mellis 73mins), Philliskirk (Dayton 73mins), Morgan-Smith, Poleon. Subs not used: Coleman, Kusunga, Lockwood, Dieng, Jacobs.
Attendance: 4,959 (236 away)