With the scores tied at 21-21, following a 78th minute drop goal by York’s Connor Robinson, the Dons were awarded a 35 metre penalty on the hooter but Jack Miller’s kick came back off the post.
Knights broke the deadlock on 18 minutes when on-loan half-back Jake Butler-Fleming intercepted a pass by Doncaster prop Russ Spiers, who spent last season at York, to score from 30 metres out near enough for Connor Robinson.
The Dons opened their account on 25 minutes. Mark Castle and skipper Kyle Kesik combined to get stand-off Kieran Cross away and he looked a certain scorer until Nev Morrison managed to nail him just short.
It only proved to be a stay of execution for York, however, with scrum-half Miller picking out the unmarked Ritchie Barnett with a pin-point cross and the recalled winger touched down out wide.
Doncaster Rovers player ratings from the dramatic draw at AFC Wimbledon
Gary McSheffrey delivered this verdict following Doncaster Rovers' late show at AFC Wimbledon
The difference of opinion and slice of luck that led Jack Degruchy to Doncaster Rovers
Recap as Doncaster Rovers produce stirring comeback to draw at AFC Wimbledon
Doncaster Rovers: Birthday boy Gary McSheffrey has got the buzz for his unexpected management shot
Miller’s conversion went in off the post to level the scores at 6-6.
Knights soon regained the lead with a superb individual try by young full-back prospect Liam Harris.
Harris fielded a high kick by Miller close to his own line and spotted a gap on Doncaster’s flank which he exploited and then left the cover for dead on his way to the line to make it 10-6.
The Dons drew level on 36 minutes with a flick-on by Miller, as the ball was quickly moved to the right, sending dual-registered centre Nick Rawsthorne – who played on loan at York earlier in the season - in at the corner.
Miller failed to add the conversion but dropped a goal shortly before the break to edge the visitors into an 11-10 lead.
York regained the initiative at the start of the second half.
Joe Batchelor just failed to get enough pressure on Johnny Presley’s neat kick over the line and the Dons were relieved to hack the ball dead.
Ronan Dixon also went close.
Mark Castle went close for the Dons before they extended their lead on 56 minute when Miloudi showed good footwork and balance to get the better of three defenders to make it 15-10.
Miller’s conversion, which would have opened up a two-score gap, came back off the woodwork.
York hit back on 61 minutes when went over Butler-Fleming scored for a close-range unconverted try from Robinson’s kick to leave just one point separating the two sides.
The Dons came under further pressure and David Foggin-Johnstone almost got a hand to a kick over the line.
The visitors extended their lead on 67 minutes. Cross split the York defence from a quick play-the-ball and found Miloudi up in support. Miller added the extras to make it 21-14.
Harris threw his side a lifeline on 70 minutes going between two Doncaster players to score a try out of nothing. Robinson tagged on the extras to close the gap to just one point and set up a grandstand finish.
Dons: Miloudi, Barnett, Rawsthorne, Tali, Doherty, Cross, Miller; Spiers, Kesik, Paleaaesina, Muranka, Martin, Green. Subs: Castle, Wright, Hedge, Braham.