Nathan Broadhead came off the bench to head home a stoppage-time winner and send Alex Neil’s side back into the League One play-off places.
The striker had missed the team’s last three matches with a hamstring injury but made the difference against a compact Gills defence.
Sunderland now have six games remaining as they try to secure a play-off place.
Our chief SAFC writer Phil Smith has delivered his verdict on how each Black Cats player fared at the Stadium of Light:
A message from the Football Clubs Editor
Our aim is to provide you with the best, most up-to-date and most informative Sunderland AFC coverage 365 days a year.
This depth of coverage costs, so to help us maintain the high-quality reporting that you are used to, please consider taking out a subscription to our new sports-only package here.
Your support is much appreciated. Richard Mennear, Football Clubs Editor
. Safc Gtfc Baff 1.jpg
Danny Batth. Photo: FRANK REID 2022
. Anthony Patterson - 6
Little to do in terms of shot-stopping but another mature showing in terms of his command of the box. 6 Photo: JPI Media
. Carl Winchester - 6
Defensively sound for the most part and made a couple of good covering challenges when called upon. Not able to produce much in his forays forward. 6 Photo: JPI Media
1. Anthony Patterson - 6
Little to do in terms of shot-stopping but another mature showing in terms of his command of the box. 6 Photo: JPI Media
2. Carl Winchester - 6
Defensively sound for the most part and made a couple of good covering challenges when called upon. Not able to produce much in his forays forward. 6 Photo: JPI Media
3. Bailey Wright - 7
Formed a strong partnership with Batth that meant Gillingham’s set-piece threat was for the most part non-existent. That was impressive. 7 Photo: JPI Media
4. Danny Batth - 7
Missed a couple of good chances from corners but won the vast majority of his defensive headers, which is precisely why he was brought back into the fold for this game. Very solid. 7 Photo: JPI Media