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.
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.
- Sports & Recreation
- Danny Kedwell
- Patrick Bamford
- Izale McLeod