The Gills were two-up within 13 minutes as former AFC Wimbledon striker Danny Kedwell scored a quick-fire brace, both from the penalty spot.
The first came after 11 minutes after defender Tom Flanagan, who was on loan at Priestfield last season, fouled Cody McDonald.
The same players were involved in the second incident two minutes later, following which Flanagan received a straight red card.
However, Dons manager Karl Robinson introduced Alan Smith and Izale McLeod and switched to a 3-4-2 formation shortly afterwards, and his bold tactical approach paid off.
Chelsea loanee Patrick Bamford headed in from Danny Green's free-kick after 26 minutes, before the same player coolly converted from close range on the half hour mark to level things up at 2-2.
Midfielder Charlie Lee should have put the hosts back in front shortly before half-time but headed straight at goalkeeper David Martin from three yards out.
Bamford nearly scored an impressive first half hat-trick, but agonisingly for the striker he was millimetres away from diverting McLeod's teasing cross past Gillingham keeper Stuart Nelson.
Gills' winner came after 59 minutes as Charlton loanee Hollands latched onto Michael Harriman's looping cross to head the hosts to their first home victory since April 6.
Bamford came close to being the Dons' hero once again eight minutes later, but Nelson was able to parry his goal-bound header.