Ben Whiteman's late penalty handed Doncaster a place in the fifth round of the FA Cup for the first time since 1956 with a dramatic 2-1 win against Oldham.
Veteran Peter Clarke looked to have denied Rovers with an 84th-minute equaliser after Whiteman's deflected effort midway through the second half had put the hosts ahead at the Keepmoat Stadium.
The result was harsh on League Two Oldham, who gave as good as they got against a side from the division above them.
The Latics hit the post and regularly tested goalkeeper Marko Marosi in an end-to-end second half, only for referee Peter Bankes to spot a late handball which gave Doncaster the decisive penalty.
Oldham then had Clarke sent off in stoppage time after he collected a second yellow card.
Rovers made five changes from their 2-2 draw with Burton last weekend, as Paul Downing was given a debut in defence in place of the suspended Andy Butler.
Oldham boss Pete Wild made just two changes, as Chris O'Grady and Jose Baxter replaced Urko Vera and Mohamed Maouche.
An attendance of 11,260 was Rovers' second highest of the season – only the visit of League One heavyweights Sunderland produced a bigger turnout – with 3,796 Oldham supporters making the journey across the Pennines.
Doncaster made a dominant start, with Herbie Kane firing a low effort wide from 20 yards and Whiteman flashing a volley across goal from similar range.
The Latics produced their first meaningful effort after 13 minutes as a quick break involving Gevaro Nepomuceno and O'Grady led to the latter shooting straight at Marosi.
Veteran James Coppinger almost put Rovers ahead moments later as his powerful volley from a Tom Anderson knock-down was well saved by Dan Iversen.
The hosts should have gone ahead after 22 minutes when John Marquis rounded Iversen, but 37-year-old Clarke defied his age to race back and produce a heroic goalline clearance.
Iversen had to be alert to keep Oldham level five minutes after half-time as he tipped Kieran Sadlier's 20-yard curler round the post, with Blackburn loanee Downing heading wide from the resulting corner.
As the game began to open up, Coppinger was denied by a last-ditch Clarke tackle after a neat move involving Sadlier and Alfie May, while at the other end Baxter headed Nepomuceno's corner narrowly wide.
Oldham were unlucky not to go ahead on the hour mark when Marosi produced a fine save to deny Johan Branger, with the rebound narrowly evading Baxter and O'Grady.
The homes side took the lead after 68 minutes when Kane laid the ball off for Whiteman and his 20-yard effort deflected off Clarke to deceive Iversen.
Marquis almost doubled Rovers' lead from Blair's cross and Iversen denied Kane, but Oldham almost drew level 13 minutes from time as Chris Missilou struck the post and Callum Lang put the rebound wide.
Nepomuceno's 20-yard free-kick after 84 minutes caused chaos in the Doncaster box and Clarke pounced in front of a delighted away end.
But moments later the contest was turned on its head again, as Bankes pointed to the spot after consulting with his linesman. Whiteman calmly despatched the subsequent spot-kick.
There was still time for Clarke to be sent off in added time after he was shown a second yellow.
ga('create', 'UA-72310761-1', 'auto', {'name': 'pacontentapi'});
ga('pacontentapi.set', 'referrer', location.origin);
ga('pacontentapi.set', 'dimension1', 'By Dave Clark, Press Association Sport');
ga('pacontentapi.set', 'dimension2', '9b95c884-76b2-4b74-8d36-f05a03ec07ac');
ga('pacontentapi.set', 'dimension3', 'paservice:sport,paservice:sport:club-news,paservice:sport:football,paservice:sport:match-reports');
ga('pacontentapi.set', 'dimension6', 'story');
ga('pacontentapi.set', 'dimension7', 'composite');
ga('pacontentapi.set', 'dimension8', null);
ga('pacontentapi.set', 'dimension9', 'sport:football');
ga('pacontentapi.send', 'pageview', { 'location': location.href, 'page': (location.pathname + location.search + location.hash), 'title': 'Whiteman takes Doncaster into last 16 of FA Cup'});