Williams coolly stroked home his spot-kick after Angelo Balanta was fouled in the box by substitute Darryl Westlake.
The hosts controlled the first half and Dean Bowditch twice went close, while Balanta had a curling 25-yard shot well-saved by George Long.
United striker Nick Blackman had a 20-yard snap-shot saved by David Martin before Dons forward Bowditch had a strong penalty appeal turned down after he appeared to be tripped by Neill Collins.
The Dons continued to dominate after the break and Ryan Lowe missed a golden opportunity when he fired straight at Long from Luke Chadwick's perfect lay-off.
The visitors rarely threatened but it looked like they would hang on for a fifth successive clean sheet until Williams' late penalty settled matters.