Gillingham's victory against Wolves prevented the visitors returning to the top of the League One table.
McDonald capitalised after Wolves had failed to clear a Jake Hessenthaler corner, and fired home from six yards to give Gills the victory.
Danny Kedwell hit the post for the hosts with an outswinging effort 10 minutes from time, and McDonald had earlier fired straight at Aaron McCarey, who made his league debut for the visitors.
Wolves had the majority of chances before that but were unable to break down a stubborn Gills defence.
Bakary Sako shot just wide from 25 yards after three minutes and had a goal-bound shot blocked by Gills defender Michael Harriman.
Kevin Doyle forced a good save from Stuart Nelson before the break, and Leon Legge nearly volleyed Scott Golbourne's cross into his own net.
James Henry also saw his curling shot well saved by Nelson after 61 minutes but it was left to McDonald to steal it late on.