On-loan Queens Park Rangers winger Mike Petrasso struck the winner for 10-man Oldham on his debut at Gillingham.
The 18-year-old Canadian, who joined the Latics on Friday, looped a second-half header over Stuart Nelson after the Gills failed to clear Danny Philliskirk's initial effort.
Cody McDonald went closest to an leveller, but Mark Oxley saved easily.
Oldham's Genseric Kasunga was sent off after a clash with Danny Kedwell, sparking a brawl between the two teams.
It was only the visitors' second away league win of the season and the first since their opening day triumph at Stevenage.
VIEW FROM THE DRESSING ROOM
Gillingham manager Peter Taylor told BBC Radio Kent:
"I'm just frustrated. We're not showing what we're capable of.
"Players are losing confidence too quickly. If everything starts right, we have a good afternoon, but if someone makes a mistake it might affect their performance.
"They kept going, they tried as hard as they could, but couldn't break them down.
"We know that was a poor performance and we know we can do better."
Oldham manager Lee Johnson told BBC Radio Manchester:
"Gillingham is a tough place to come. Complacency could have set in from our boys, but I thought we were very, very professional and comfortable throughout the game.
"We defended like soldiers. Generally our play is excellent and the boys really deserve the pat on the back.
"He [Mike Petrasso] has been performing very well in the Under-21 league and we've been tracking him for a while. He did well today and put in a good defensive shift.
"It was a tough ask for him to come in after two days and go straight into it. He scored a goal and he'll be able to phone home to his parents in Canada. They'll be proud of him."
Gillingham 01 Nelson 23 Harriman 03 Martin 19 Hollands (Weston - 65' ) 06 Legge Booked 26 Barrett (Dack - 88' ) 29 Hewitt Booked 32 Mousinho 10 McDonald 09 Kedwell Booked 07 Whelpdale (Fagan - 65' ) Substitutes 05 Davies 08 Akinfenwa 11 Weston 15 Dack 21 Howard 27 Fagan 31 Hessenthaler Oldham Athletic 01 Oxley Booked 08 Smith Booked 23 Mills 04 Wesolowski 06 Tarkowski 03 Grounds 20 Petrasso (Schmeltz - 60' ) 05 Kusunga Dismissed 27 Philliskirk (MacDonald - 74' ) 14 Clarke-Harris (Rooney - 74' ) 19 Dayton Booked Substitutes 07 Schmeltz 09 Rooney 10 MacDonald 15 Winchester 17 Rodgers 18 Lanzoni 29 Rachubka