The League Two visitors took a shock lead from the penalty spot in the 19th minute through James Tilley after Chelsea keeper Robert Sanchez brought down Harry Pell inside the box. Tilley fired home as the Dons dreamed of their biggest result since being founded in 2002.
Chelsea continued to enjoy the lion's share of possession but failed to make it count until they were awarded a penalty for a foul on Noni Madueke, which the England under-21 forward converted in first-half stoppage time.
Substitute Enzo Fernandez grabbed the winner for the hosts in the 72nd minute with his first goal for the club. Goalkeeper Alex Bass made a mistake by clearing the ball straight to Malo Gusto and £106m man Fernandez was subsequently handed an easy tap in into an empty net.