Shaun Williams’ 80th-minute penalty had seemingly put the Dons on course for victory but Cook netted a cool one-on-one and a 90th-minute spot-kick of his own to snatch the win.
The hosts had the better of a low-key first half and Mathias Doumbe curled a great chance wide early on after a neat one-two with Daniel Powell on the edge of the box.
The Dons upped the tempo after the break and Luke Chadwick and Dean Bowditch both had efforts cleared off the goalline by Peter Murphy and Danny Livesey respectively.
Lee Miller then blazed a 73rd-minute penalty, the first of three at stadiummk, high over the crossbar for the visitors after substitute Jabo Ibehre had handle Jon-Paul McGovern’s corner.
Dons midfielder Williams showed him how it should be done by converting from the spot after Bowditch had been dragged down in the box by Livesey. But Cook equalised in the 83rd minute when he slotted in Miller’s low cross before he sent David Martin the wrong way from the spot at the close after Tom Flanagan had tripped him in the box.