More than 1,200 Black Cats fans went home happy after watching Sunderland come back from a goal down to claim the points with second-half strikes by John Oster and Marcus Stewart.
Gillingham, missing a total of ten players due to injury and illness, took the lead on 37 minutes, but Sunderland drew level on the stroke of half time and were much the better team after the break.
Gills boss Andy Hessenthaler conceded as much saying: "I think Sunderland are the best team we have played here so far this season.
"They had much more movement and pace than us in the second half but our preparation was poor and we had to rely on kids on the bench including Matthew Jarvis, a second year YTS boy."
It looked good for the Gills though as they aimed for a third successive win. They took the lead through Paul Shaw with a well-rehearsed corner kick routine.
Chris Hope flicked on Hessenthaler's corner and Shaw headed home. It could have been 2-0 a minute later when Sunderland keeper Mart Poom just kept out Mamady Sidibe's effort on the line.
Stewart should have brought Sunderland level, but headed against a post from just a yard out. However, Stewart Downing, on loan from Middlesbrough, equalised to send McCarthy's men level at the break and they never looked back.
Downing was at the hub of much of Sunderland's best work. He set up the second for Oster on 58 minutes, after Kevin Kyle had blasted an earlier effort against the angle of bar and post.
Sunderland's third came from a superb five-man move, stemming from a Gillingham corner which was charged down.
Gillingham were stretched at the back and Oster set up Stewart for the third as he netted his sixth goal of the season.