Martin O'Neill's first match as Sunderland manager ended in a stoppage-time victory as Sebastian Larsson's free-kick sealed a strong rally over fellow Premier League strugglers Blackburn Rovers.
There were only six minutes of normal time left when David Vaughan's powerful shot flew past Paul Robinson, the former England goalkeeper, to draw Sunderland level at the Stadium of Light.
And just when it seemed the hosts would have to settle for a draw, Blackburn conceded a free-kick and Larsson curled a shot around the defensive wall that flew in at Robinson's near post.
"We needed a win and in that kind of a manner," Larsson said later to Sky Sports 1.
"I've never had that much possession that we did in the second half, but we just couldn't score until Vaughan popped up with a fantastic strike."
Victory meant Sunderland climbed out of the relegation zone while Rovers remained in the bottom three.
The win was only the third league success of the season for Sunderland, who recently parted company with Steve Bruce, their previous manager .
Simon Vukcevic, the Blackburn midfielder, opened the scoring in the 17th minute when he headed home after Keiren Westwood, the Sunderland goalkeeper, could only parry a shot from Christopher Samba.
Asked about the influence of O'Neill, Larsson added: "He's come in with a lot of energy and enthusiasm, and told us he believes in us.
"We've had a tough time but this will do us the world of good, and hopefully we can push on.
"I think we deserved to win but we've said that all season and you can't keep saying it."