F-T: Rotherham United 2 Oxford United 3
The second tier's bottom club failed to progress to the fourth round for the 15th successive year.
The Millers trailed at the break to a goal by old boy Ryan Taylor and then looked the likely victors as striker Danny Ward equalised and they pressed for a second goal.
But Oxford turned the game on its head with late goals from Phil Edwards and substitute Kane Hemmings.
Tom Adeyemi's 89th-minute header closed the gap but counted for nothing in the end against a U's side who could afford to miss a first-half penalty and still go through.
Rotherham lost Peter Odemwingie to injury in the warm-up which meant a rare start for centre-forward Dexter Blackstock.
The Millers were first to show when striker Ward fired across goal and wide in the second minute, but Oxford responded with a long run and shot over by left-back Marvin Johnson soon after and Rotherham old boy Chris Maguire should have opened the scoring for the visitors in the 10th minute but couldn't hit the target.
Maguire fared even worse in the 35th minute, seeing his penalty saved by Lewis Camp after another ex-Rotherham player, Ryan Taylor, had been upended by centre-half Kirk Broadfoot.
The U's were ahead six minutes later when the ball was cut back from the byline and Taylor applied a crisp, low finish.
Midfielder Adeyemi was close to an equaliser on the stroke of half-time as Simon Eastwood did well to push his header for a corner.
Rotherham were much better after the break and Ward shot them level with a stunning strike in the 51st minute.
Oxford's Robert Hall brought a save from Lewis Price in the 57th minute, but the Millers were now dominating. A 59th-minute Ward piledriver, following a probing run by Anthony Forde, was inches over and Will Vaulks hit the post from 20 yards out two minutes later.
Ward was proving too hot for the visitors to handle and he powered away from two opponents in the 70th minute only to see his shot saved.
However, Oxford went ahead against the run of play after 80 minutes when a Ryan Ledson shot brought a flying stop from Price and Edwards nodded in the corner that followed.
They confirmed their place in the fourth-round draw when Hemmings knocked the ball in from close range in the 88th minute, seconds before Adeyemi finished off sub Jerry Yates' cross.
Caretaker manager Paul Warne had made three changes from the team beaten 3-0 at Leeds United in the Championship on Monday.
With attacker Izzy Brown recalled from his loan by Chelsea and now at Huddersfield Town, Odemwingie had been selected to start just behind Ward.
Richard Wood was preferred to Aimen Belaid in central defence and Vaulks replaced injured captain Lee Frecklington in midfield as the armband went to Broadfoot.
The final whistle brought jeers from some home fans.
Rotherham United (4-4-1-1): Price; Fisher, Broadfoot, Wood, Mattock; Forde, Adeyemi, Vaulks, Newell; Blackstock (Yates 53); Ward. Subs not used: McMahon, Kelly, Taylor, Wilson, Belaid.
Oxford United (4-4-1-1): Eastwood; Edwards, Dunkley, Nelson, Johnson; Hall (Sercombe 74), Lundstram, Ledson, MacDonald; Maguire (Rothwell 81); Taylor (Hemmings 81). Subs not used: Buchel, Skarz, Ruffels, Raglan.
Goals: Ward 51, Adeyemi 89 (Rotherham); Taylor 41, Edwards 80, Hemmings 88 (Oxford).
Referee: Darren Bond (Lancashire).
Attendance: 5,618 (1,292).