The striker put Latics ahead 10 minutes before half time as he headed home after Aaron Amadi-Holloway struck the crossbar.
Oxford United levelled on the hour mark after Connor Ripley was adjudged to have fouled Chris Maguire in the penalty box.
Maguire sent Ripley the wrong way to equalise but with 20 minutes remaining, Erwin notched his second goal of the game, heading home at the back post, to seal all three points for Latics
Manager John Sheridan made three changes to the side which drew 0-0 against Bury on Saturday.
Brian Wilson, Rob Hunt and Lee Erwin returned to the starting 11 and it would be Latics who would start the first half strongly.
In the opening two minutes of the game, Athletic should have been ahead through Holloway.
Chris Taylor released the striker in the penalty area but Oxford United goalkeeper Simon Eastwood managed to deny him from close range.
Minutes later and Latics had another opportunity to go ahead through the captain Peter Clarke.
After a corner into the box was not cleared, the ball bobbled around but Clarke could not direct his effort goalwards.
U’s striker Chris Maguire hit a free kick over the crossbar on 12 minutes before Latics had another golden opportunity to take the lead.
Taylor released Ryan McLaughlin on the right but he elected to take his shot early and Eastwood made the save from the edge of the box.
Athletic had to be wary on 14 minutes as Connor Ripley got out quickly to deny Conor McAleny from close range before he parried Maguire’s effort away for a corner.
Oxford had their best spell of the half as Kane Hemmings missed from five yards out.
Anthony Gerrard was booked midway through the first half for a late challenge on Maguire, the striker picked himself up but smashed his free kick over the crossbar.
Holloway was proving to be a threat in attack and he again worked a chance for himself on the half hour mark but again Eastwood denied him from close range.
The first time Holloway did manage to beat the goalkeeper was on 36 minutes as his effort from close range smacked against the crossbar but Erwin was on hand to head home from close range to put Athletic ahead.
Latics were hit with a blow five minutes before the break as Hunt limped off with a recurrence of a hamstring injury as he was replaced by Josh Law.
Banks had an effort before the end of the half which was deflected wide as Latics went into the half time interval ahead.
The visitors started the second half the better of the two sides as Maguire volleyed over from 25 yards.
Minutes later Holloway struck over the crossbar before McAleny created space for himself in the penalty area but was eventually crowded out.
The visitors continued to put the pressure on Latics and won a penalty on the hour mark as Ripley was adjudged to have brought down Maguire in the penalty box.
The striker stepped up and sent the goalkeeper the wrong way to equalise for the U’s.
Latics responded well to going a goal behind and quickly set about finding their second of the game.
Law curled past the post from 25 yards whilst Taylor headed over at the back post as Latics pressed for their lead back.
They did manage to get that back on 70 minutes as Erwin headed his second of the game to put Latics back ahead.
McLaughin received the ball on the right, whipped a deep cross into the box and Erwin was there to stoop home at the back post to net for Latics.
That goal came at a good time for Latics but it made for a nervy last 20 minutes of the game.
However, it would be Erwin who almost completed his hat trick a minute later but he was denied from the edge of the box by Eastwood.
John Lundstrum struck over the crossbar from 30 yards whilst Maguire’s free kick minutes later was deflected wide for a corner.
Latics cleared the danger and looked really bright on the break.
The fans were really getting behind the players as Oxford looked for an equaliser but Latics’ defence stood resolutely.
The referee eventually blew the full time whistle as Latics recorded a vital three points.
Oldham Athletic: Ripley, Wilson, Clarke, Gerrard, Hunt (Law 41’), McLaughlin, Green, Banks, Taylor (Fane 90+3’), Erwin (Obadeyi 79’), Holloway.
Subs not used: O’Neill, Flynn, Ngoo, Osei.
Oxford United: Eastwood, Lundstrum, Nelson, Maguire, McAleny, Hemmings (Martinez 78’), Edwards, Hall (Rothwell 78’), Ledson (Sercombe 66’), Johnson, Dunkley.
Subs not used: Skarz, Ruffels, Raglan, Stevens.
Goals: Oldham Athletic (Erwin 36’, 70’) 2-1 Oxford United (Maguire 60’)
Attendance: 3,124 (383 visiting supporters)