For a long time it looked as if an own goal by Dons captain Dean Lewington was going to cause a shock result but the hosts managed to strike twice at the death to reach the second round.
Orient surprisingly went ahead after 36 minutes when Lewington, under pressure from Ollie Palmer, saw Dean Cox’s cross come off his shin and trickle past a slipping Cody Cropper.
The visitors almost doubled their lead when Cox played the ball inside for Palmer, whose shot came back off the post and nearly rebounded in off Cropper.
The visitors still had chances to add a second as Cropper denied Jay Simpson following Scott Kashket’s breakaway and they were to shoot themselves in the foot.
In the 90th minute substitute Ben Reeves sent in a cross from the right that Mathieu Baudry headed into his own net despite being under no real pressure.
With the O’s flagging, the Dons dramatically snatched the tie when Simon Church slid the ball through to Baker, who produced a fine finish into the bottom corner.