The Doncaster Rovers loanee latched on to the end of a James Wilson flick to nod Latics into a two goal lead after Liam Kelly’s 10th minute header had give them the lead going into the half time break.
Latics saw the game out confidently, retaining possession with the defence standing resolutely to record their third clean sheet in a row.
However, Fleetwood Town’s 2-0 victory over Peterborough meant Latics stay in the relegation spots, only one point behind their rivals.
John Sheridan was forced into changes due to injuries so Jonathan Forte and Main led the line for Latics.
It would be Athletic who got off to the better start, putting the pressure on the Swindon defence from minute one.
Whilst Robins midfielder Michael Doughty had the first shot of the game, it would be Latics that took the lead on 10 minutes.
Jonathan Forte managed to get beyond his man, crossed into the centre and from 10 yards, Liam Kelly headed into the top corner to give Athletic a dream start.
However, Swindon responded well after going a goal behind and almost hit back immediately.
A deep cross into the box found Bradley Barry at the back post but his header smashed the woodwork and went away from danger.
Ellis Landolo was booked on 15 minutes for a pull back on Forte, however, six minutes later, Forte himself would walk into the referee’s notebook after kicking the ball away.
Latics were pressing the ball well and it was persistent play from Matt Palmer which caused the next opportunity of the game for Latics midway through the half.
He won the ball in midfield, spotted the run of Forte who peeled off his last defender. He controlled the ball into his path but his shot was straight at Swindon Town goalkeeper Tyrell Belford.
Louis Thompson was proving effective in the middle of the park and just before the half hour mark, his pace took him past Tim Dieng but Joel Coleman was equal to his long range strike.
It would be Latics that finished the half the stronger, forcing a couple of efforts just before the half time whistle.
As two minutes of additional time was announced by the fourth official, Forte crossed into the box but Main’s acrobatic effort was saved by Belford.
A minute later, it would be Forte again who caused havoc. He raced to the byline and whipped in a teasing cross which was inches ahead of the Doncaster Rovers loanee, who was so close to making it 2-0 to Latics.
Athletic started the second half the same as they finished the first as they took the game to their opponents.
Tareiq Holmes-Dennis shot in the first five minutes of the half which did not test Belford, but Latics were continuing to play good attacking football.
Whilst Landolo shot from 25 yards over the crossbar, that was their only real chance of the second half as Latics took complete control of the game.
Wilson met a Palmer cross just before the hour mark which fell just wide of the goal, and two minutes later, a strong run from Holmes-Dennis caused a corner.
It was Wilson who this time turned provider as he crossed to the back post where Main stood but his header was tame and well saved.
Swindon were struggling to create chances and were denied a penalty with 20 minutes of the game remaining as Brandon Ottewill went down in the area but the referee shook his head.
The Robins were penalised on 80 minutes for their persistent off the ball fouling, and that would be where Latics scored their second goal from.
However, before the free kick could be taken, Anthony Gerrard and two Swindon defenders got themselves in the referee’s notebook after an altercation in the penalty area.
As the free kick came into the box, Gerrard managed to get the upper hand on his defender before Wilson flicked the ball into the path of Main who looped his header over the goalkeeper to give Latics a two goal lead.
That was the first goal in Oldham Athletic colours for the Doncaster Rovers loanee and the goal halted any Swindon momentum.
The final minutes of the game were professional seen out by Latics, retaining the ball and limiting their opponents to no shots on Coleman’s goal.
Dummigan’s volley was saved on 86 minutes and minutes later the Swindon goalkeeper was called upon again as he saved Dieng’s curled shot.
Latics saw out the final minutes of the game comfortably, however, Fleetwood’s victory over Peterborough United meant Latics still sit in the final relegation spot.
Oldham Athletic: Coleman, Dummigan, Gerrard, Dieng, J.Wilson, Holmes-Dennis, Kelly, Palmer (Winchester 87’), Jones (Croft 90+1’), Forte (Cassidy 76’), Main.
Subs not used: Cornell, Brown, B.Wilson, Mills.
Swindon Town: Belford, Ottewill, Turnbull, Doughty, Thompson, Sendels-White, Hylton (Young 57’), Rodgers, Barry (Brophy 72’), Landolo (Cooke 70’), Rossi-Branco.
Subs not used: Balmy, Marshall, Henry, Evans.
Goals: Oldham Athletic (Kelly 10’, Main 82’) 2-0 Swindon Town
Attendance: 3,730 (177 visiting supporters)