Sunderland took the lead inside four minutes when debutant Ellis Simms, on loan from Everton, opened the scoring.
The hosts drew level six minutes later through Andi Weimann, before Chris Martin put the Robins ahead.
Simms then added a second, allowing Ross Stewart to head home the winner 18 minutes from time.
Our chief Sunderland writer Phil Smith has dished out his player ratings from Ashton Gate:
1. Anthony Patterson - 6
Claimed a couple of really dangerous set plays late on, which was crucial. Had struggled a bit up until that point with some erratic distribution. 6 Photo: Frank Reid
2. Lynden Gooch - 7
Tenacious defensively and had a really good second half, particularly late on when Bristol City tried to apply pressure. 7 Photo: Frank Reid
3. Daniel Ballard - 7
Stepped out with the ball really well in the second half which helped Sunderland push Bristol City back. Made one tremendous late block to deny Weimann a certain goal. 7 Photo: Frank Reid
4. Danny Batth - 7
Looked a touch uncertain at times with Sunderland conceding a couple of sloppy goals, but won his fair share of aerial duels. 7 Photo: FRANK REID 2022