Nigel Pearson was given a winning start to life as Bristol City manager as they came from behind to win 3-1 at Swansea in the Sky Bet Championship.
Kasey Palmer looked as though he had gifted his old side victory when he handled in the box to allow Andre Ayew to give the hosts a deserved lead from the penalty spot.
But Nahki Wells equalised started the comeback, Palmer scored direct from a corner, then Antoine Semenyo sealed City's second win in a week to give Pearson the dream start to life as manager.
Pearson watched on from the stands as his new side overcame Middlesbrough at the Riverside to end their run of six successive Championship defeats.
And the experienced former Leicester and Watford manager kept the faith with the same starting XI for the trip to south Wales.
It took some last ditch defending and heroic goalkeeping from Daniel Bentley to keep Swansea at bay in the first half.
The Robins goalkeeper produced a reaction save to push Jamal Lowe's fierce half-volley over the bar, before using his midriff to deny Yan Dhanda as the Swans consistently found routes through the defence.
The one-way traffic continued as the half wore on, but the hosts failed to capitalise.
Adrian Mariappa came to the rescue five minutes before half-time to clear Ben Cabango's effort off the line, before Bentley made another important save from Conor Hourihane's header to keep it goalless.
Pearson hauled defender Ryley Towler off just before the half-time, but the change could not prevent Swansea finding the breakthrough in the 54th minute through Palmer.
The man who spent the first half of the season on loan at the Liberty Stadium used his arm to stop a Matt Grimes ball reaching Jake Bidwell at the back post.
Referee Keith Stroud pointed to the spot and Ayew calmly beat Bentley to net his 10th goal of the season.
But a tactical switch from Pearson to put centre-back Zak Vyner in midfield bore fruit as the visitors got themselves back on level terms 10 minutes later.
Vyner pressed high to pounce on a loose ball that was missed by Marc Guehi. He then had the composure to pick out Wells with a low cross, and the striker beat Freddie Woodman with a low drive.
Woodman was then caught out by former team-mate Palmer, who struck a curling corner high beyond his reach to spark celebrations on the Bristol City bench with 10 minutes remaining.
And Semenyo ensured Swansea gave up ground on their promotion rivals by closing down Woodman to block a clearing kick, before tapping home the rebound in the 90th minute.