MK Dons fought back from a two-goal deficit to earn a home third-round replay with FA Cup holders Wigan.
Roger Espinoza's superb 30-yard strike put the hosts ahead before Jordi Gomez fired in to double the lead.
But Ben Reeves struck twice, in the 45th minute and first-half injury time, to make it level at the break.
Shaun Williams then missed a penalty for the Dons and Callum McManaman put Wigan back in front before Patrick Bamford found the net to make it 3-3.
Wigan looked to be cruising towards the fourth round as half-time approached.
FA Cup fourth round draw
Sunday, 5 January 2014
Cousins Martin and Paul Allen, who both played for West Ham, will make the draw after the Hammers face Nottingham Forest.
Fourth round dates:
Ties to be played over the weekend of 25 and 26 January 2014
But with just one second of normal time in the first half remaining, Reeves showed great footwork as he struck a neat shot past Ali Al Habsi.
And the Dons were level inside two minutes as Reeves found the net again, steering the ball home from inside the area.
MK Dons should have taken the lead after the break, when James McClean fouled substitute George Baldock inside the box, but Al Habsi matched his competent attempt with a diving save.
Wigan were ahead seconds after as McManaman broke the offside trap before firing past David Martin.
But the Dons were not finished and restored parity for a second time when, with eight minutes remaining, Bamford's close-range finish kept their chances of knocking out the FA Cup holders alive.
Check out a photo gallery from all of today's FA Cup fixtures on the
BBC Sport Facebook page.
Wigan Athletic 26 Al-Habsi 17 Boyce 22 Beausejour 16 McArthur Booked 25 Barnett 24 Perch 15 McManaman 18 Espinoza 14 Jordi Gómez Booked (McCann - 45' ) 09 Holt (Fortuné - 59' ) 11 McClean (Dicko - 75' ) Substitutes 03 Crainey 07 McCann 12 Pollitt 20 Fyvie 28 Redmond 29 Dicko 32 Fortuné Milton Keynes Dons 01 Martin 05 Hodson (Baldock - 35' ) 03 Lewington 08 Potter 24 Kay 06 Williams Booked 22 Carruthers (Galloway - 71' ) 07 Gleeson 15 Bamford 12 Reeves 14 Alli Booked (Powell - 71' ) Substitutes 04 Flanagan 10 Chadwick 11 Smith 16 McLoughlin 17 Powell 18 Baldock 19 Galloway
Ref: Roger East