Sunderland bounce back to claim dramatic victory and steal ground in the League One promotion race
Sunderland ended their frustrating run of draws in a six-goal thriller at the Stadium of Light.
A reassuring night for the Black Cats also saw Will Grigg open his Sunderland account with a crucial second half penalty.
Aiden McGeady, Lee Cattermole and Tom Flanagan also got on the scoresheet in a 4-2 win.
They had twice been pegged back in the first half and did suffer one significant injury concern, with Chris Maguire taken off early in the first half in significant discomfort.
Sunderland had started the game brightly with Maguire returning to the XI and George Honeyman moving out the right.
Both started well and with just five minutes on the clock the Black Cats were ahead.
Grant Leadbitter whipped a wonderful corner towards the penalty stop, where Jimmy Dunne had done well to get the run on his marker. He looked to be hauled to the ground but as the referee let play run on, Lee Cattermole, recalled to the side after a long spell out with an ankle injury, thumped home the loose ball.
Before the game Jack Ross had stressed the importance of getting ahead and not having to force it.
Having finally done so, his team were pegged back within a minute.
The defence switched off and allowed Tom Eaves to run free, the striker cleverly taking the ball round Jon McLaughlin and as Tom Flanagan challenged, the ball was turned into the bottom corner.
To their credit the home side were not shaken and they were back in the lead four minutes later when another excellent Leadbitter delivery found the unmarked Flanagan, who headed home well.
Sunderland's attacking play was continuing to improve but they were dealt a blow when Chris Maguire went down after winning a 50-50 challenge. he tried to run the knock off but had to be placed by Lynden Gooch.
Gooch, whose form has been poor of late, did bring purpose to Sunderland's play and they continued to be the better side, even if the final was lacking.
The tempo began to dip and the Black Cats were rocked five minutes before half time.
They failed to deal with a Gillingham corner and Brandon Hanlan was left free to strike a firm effort past McLaughlin.
The threat of a third frustrating result in a week loomed large as Sunderland began the second half indifferently, shaky in their distribution from the back and with Will Grigg increasingly isolated up front.
They did force a save when Grant Leadbitter struck one from range, forcing a good save low to his right from goalkeeper Tomas Holy.
Sign up to our daily newsletter
The i newsletter cut through the noise
Grigg felt he was held in the box when McGeady tried to cross the loose ball but nothing was given.
Referee Matt Donohue was left with no choice soon after when another cross the back post cleared the Gillingham defence. Luke O'Nien looked set to pull the trigger at the back post but was brought down by a clumsy challenge from Leo Da Silva Lopes.
Grigg chased to gather the ball and after Aiden McGeady stepped aside, finally got off the mark by firing the penalty straight down the middle of the goal.
The Black Cats came close to doubling their advantage when Gooch did well to spin away from his marker in the middle of the pitch, releasing McGeady just inside the Gillingham box.
His effort looked goalbound but Holy got down well to block.
That disappointment was brief, McGeady on the scoresheet when O'Nien was again brought down in the box.
This time Grigg let the winger step up and he replicated the striker's effort, scoring straight down the middle.
By now Sunderland were dominant and Honeyman went close to making it five when he raced onto McGeady's clever low cross, firing over just over the bar.
Gillingham steadied and ended the game stronger but the Black Cats were ultimately able to comfortably secure the three points.
Sunderland XI: McLaughlin; O'Nien, Flanagan, Dunne, James; Leadbitter (McGeouch, 84), Cattermole (Power, 89), Honeyman; Maguire (Gooch, 18), McGeady, Grigg
Subs: Ruiter, Ozturk, Wyke, Morgan
Gillingham XI: Holey, O'Neill, Ehmer, Ogilvie, Fuller; Byrne, Da Silva Lopes (Charles-Cook, 68), Oldaker (List, 74) Burke (Parrett, 89); Hanlan, Eaves
Subs: Reilly, Campbell, King, Hadler
Bookings: Burke, 33 Honeyman, 53 Byrne, 58 Dunne, 67 Da Silva Lopes, 74
Attendance: 28, 364