Goals from Kieran Trippier and Andre Amougou cancelled out Daniel Powell's early opener to make sure the Clarets progressed, but the hosts were made to work by their League One rivals.
The Dons started the brighter and took the lead on six minutes.
A neat passing move, working from back to front, saw Dean Bowditch play a clever one-two with Luke Chadwick. The former Manchester United midfielder then threaded through Jabo Ibehre, who in turn fed Powell.
Powell easily turned his marker to spin into space and fire a shot into the bottom left-hand corner.
Burnley, shocked by the early goal, quickly retaliated through Jay Rodriguez.
The striker saw one effort saved by visiting keeper David Martin before he nodded wide in search of the equaliser. But those were two isolated moments in an otherwise comfortable first 20 minutes for the League One promotion-chasers.
And the away side could easily have doubled their advantage when the ball fell to Powell inside the box. From a good position, however, the 20-year-old contrived to slide his effort wide of the right-hand post.
For all the Dons' dominance, Burnley had a glorious chance to level on 25 minutes.
Shaun Williams dallied in possession, Dean Marney took advantage and centred for Rodriguez - who should have done better than scuff his shot past the post.
Keith Treacy wasted a good opportunity from distance soon after, but the Clarets were steadily finding a foothold on proceedings at Turf Moor.
However, it was the visitors who came closest before half time - Bowditch sending a rasping 30-yard drive inches over the bar, George Burdock firing a long-range effort narrowly over and Ibehre seeing his header well saved by Lee Grant.
After the break Burnley came out of the blocks quickly. Treacy and Wallace peppered the Dons' box with crosses and Rodriguez saw his header cleared off the line by Chadwick. But Clarets stopper Grant still needed to be alert to produce a stunning double save from Ibhere and Chadwick and keep the Championship side in the contest.
And that moment of magic from the keeper proved crucial just before the hour, when Trippier levelled for the hosts.
Chadwick was penalised for handball by referee Scott Mathieson just outside the area, and Trippier produced a sublime free-kick to find the bottom corner.
Both sides exchanged chances as the match drifted towards 90 minutes without a decisive strike, with Anthony McNamee forcing Grant into another good stop and Rodriguez glancing a header narrowly wide, but just as it looked as though the clash was going to extra-time Burnley popped up with a winner.
Wallace provided the cross and Amougou's overhead kick found the bottom corner to break Dons' hearts and secure progression for Eddie Howe's men into round four.