The Dons cheered on by 100 noisy supporters housed in a corner of the Gordon Road Stand completed their third win in five games thanks to Patrick Agyemang's second-half winner.
His pace was a constant threat to the Gills and player-manager Andy Hessenthaler must be wondering whether he picked the right team.
He brought back Chris Hope and Ian Cox after one match bans, sacrificing himself and David Perpetuini, but was disappointed with his team's defending for both Wimbledon goals.
Cox was at fault for the first, failing to clear a cross from the left and the nippy Wade Small fired in a shot which Jason Brown could only parry to Adam Nowland, who scored with a low, angled drive.
Wimbledon boss Stuart Murdoch had been desperately trying to sign another goalkeeper this week, but in the end Steve Banks returned after a nine-week absence and performed well against his old club.
His best save came as early as the 11th minute, keeping out a goal-bound effort from his former Bolton team-mate Rod Wallace.
Wimbledon then went in front, but Gillingham went close through Danny Spiller before he and John Hills set up the equaliser for Nyron Nosworthy four minutes before the break.
Gillingham dominated the second half with Banks keeping out efforts from Hope and Spiller again, before the Dons regained the lead with Agyemang netting his seventh of the season following a great pass from skipper Nigel Reo-Coker.
The home side kept searching for an equaliser with Paul Shaw and Hope having efforts deflected away for corners.
Agyemang might have made it 3-1 just before the end, and there was still time for Banks to keep out another effort from Wallace, who then sent a header wide just before the end.