A tight tie looked to be heading for the tension of a penalty shoot-out until Hoban rose to head home a James Baxendale cross on 84 minutes.
A Baxendale free kick then saw Hoban bury another superb header two minutes into added time to seal the win and put Stags two games from a Wembley final.
It was a fifth game without a win or a goal for the dejected Latics who had earlier wasted chances to win it, Mal Benning producing a crucial goal line clearance in the first half to deny Darius Osei from only four yards.
But Stags were always a match for their more illustrious rivals and thoroughly deserved the win.
Now they will await the quarter-final draw on Thursday morning.
Mansfield’s line-up showed three changes, Baxendale, Chris Clements andHoban replacing Joel Byrom, Ben Whiteman and Matt Green from the side that turned over Crewe 3-0 on Saturday.
New arrivals Byrom and Whiteman are both cup-tied for this tournament while Green began the night on the bench.
Visiting League One strugglers Oldham also made three changes to their starting line-up.
The Latics have lost three of their last four games - not scoring in any of them - with their last win coming in the second round of this competition.
Stags had an early scare as a low Paul Green shot took a deflection, but an offside flag went up anyway before anyone could reach the loose ball.
On 13 minutes Bennett got up to nod a Benning cross at goal but straight to the keeper.
Hamilton had already hacked down Hamilton before he was hauled down by Edmundson on 14 minutes for a well-deserved booking.
A good run by Hoban saw him reach a Benning ball forward down the left and tee up Hamilton to come in off the left wing onto his right foot, but his shot was poor and straight at the keeper.
Neither keeper had a real save to make until the 21st minute when Croft’s through ball saw Stags’ offside appeals turned down and McLaughlin race into the pass down the left, only to see Kean get down and block the finish with his hand.
Soon after home fans were furious as another call for offside was again ignored and this time the ball was half-cleared to Wilson, who sent a rising shot well over from 20 yards.
On 25 minutes Hoban set up Clements for a low shot that wasn’t too far wide from the edge of the box.
The game remained tight with the visitors playing some nice football, though failing to trouble Kean,
But Oldham should have been ahead three minutes from the break.
A long cross from the left was nodded down by Flynn at the far post and Osei, four yards from goal in the middle, looked a certain scorer only to see Mal Benning produce a fantastic block almost on the goal line.
Soon after Benning was booked for kicking the ball away after a whistle.
In added time Kean then had to get his leg in the way of a rasping Wilson piledriver from 25 yards that took an awkward bounce en route.
A quiet start to the second half saw two Stags corners cleared and, on 57 minutes Clements was booked for a revenge trip after feeling he had been fouled.
Two minutes later Wilson was booked for dissent as referee Drysdale tried to sort out pushing at an Oldham corner.
On 61 minutes Oldham made a double change with McKay and Banks on for Croft and Flynn.
But a minute later the home side almost broke the deadlock and Benning crossed from the left and Hoban guided a finish wide off his instep from eight yards.
Howkins had stayed down after an important tackle on the marauding Fane. He tried to carry on but looked uncomfortable and, with the big derby ahead on Saturday, it was decided to take him off on 70 minutes with Mitch Rose coming on to play right back and Bennett moving into the middle.
Clements sent a curling shot at Ripley and Baxendale fired well over, both efforts from outside the box as we reached the 75 minutes mark with the sides deadlocked.
On 77 minutes Edmundson should have done better as he headed over from Oldham’s sixth corner of the contest.
Three minutes later Clarke headed wide at the far post from another flag kick for the visitors.
Law became the night’s fifth booking on 80 minutes for kicking the ball away.
With seven minutes to go, Thomas and Green were thrown on for Clements and Arquin.
A minute later the deadlock was finally broken.
Hamilton crossed to the far post wher Baxendale controlled the ball and sent it high back across goal where a delighted Hoban was able to steer a close range header past a helpless Ripley.
In the final minute an Oldham free kick wasn’t cleared and Winchester hooked a decent chance wide and with it went Oldham’s hopes.
Five minutes were added and Hoban made sure of Mansfield’s passage two minutes into it as he rose from 10 yards to power home his header from Baxendale’s free kick from the right.
STAGS: Kean, Bennett, Benning, Collins, Pearce, Clements (Thomas 83), Hoban, Baxendale, Howkins (M. Rose 70), Arquin (M. Green 83), Hamilton. Subs not used: Shearer, Hurst, Hemmings, McGuire.
OLDHAM: Ripley, Law, Wilson, Flynn (Banks 61), Croft (McKay 61), Edmundson, Osei, Fane, Clarke, McLaughlin, P. Green (Winchester 70). Subs not used: Kettings, Dummigan, King, Glackin.
REFEREE: Darren Drysdale of Lincolnshire.
ATTENDANCE: 1,343 (149 away). CHAD STAGS MAN OF THE MATCH: Pat Hoban.