Cardiff City 0-1 Bristol City
Bristol City are the first visiting side to win at Cardiff City this season in the Championship thanks to Josh Brownhill.
The Robins captain's spectacular strike in the 67th minute saw Lee Johnson's team climb to sixth in the table.
They were made to work for this win, with Cardiff not giving up their unbeaten home record without a fight.
The hosts, who remain 14th in the table, hit the woodwork on three occasions.
Neil Warnock's side could count themselves unfortunate to come away with nothing.
But it was Brownhill's moment of quality which proved the difference as Bristol City's promising season continued.
Cardiff are without a win on their travels this season, but have been a formidable proposition on their own patch.
They have usually delivered results without always playing particularly well, and it was Bristol City who gained the early momentum here as Marley Watkins' shot was blocked and Callum O'Dowda lifted a shot over the bar.
Yet Cardiff grew into the contest, with Nathaniel Mendez-Laing and Leandro Bacuna firing wide of the target either side of an Omar Bogle header which was saved by Daniel Bentley.
The best moment of the first period was provided by Junior Hoilett, who unleashed a fierce 25-yard drive which had Bentley beaten, but cannoned to safety of the crossbar.
Bristol City were under pressure for a spell, with Cardiff enjoying more possession than they have in many home games this term, but the visitors showed sufficient resilience to get through to half-time unscathed.
Shorn of their two top scorers this season - the suspended Danny Ward and injured Joe Ralls - Cardiff were in need some inspiration going forward.
Bogle was getting himself into dangerous positions, the big striker heading wide and then seeing a low shot blocked by Pedro Pereira.
But it was Bacuna who almost made a difference just before the hour when his long-range drive left the visitors' bar rattling for a second time.
Cardiff were looking the team most likely to go in front, yet it was their opponents who conjured a breakthrough.
When Tommy Rowe found Brownhill 25 yards from goal, the midfielder's drive had too much pace and swerve for home keeper Neil Etheridge and flew into the net.
Bristol City could have put the game to bed very quickly as Andreas Weimann took aim from close range, but Etheridge was this time able to smother.
Cardiff searched for a response, with the impressive Ashley Williams, who was jeered all day by the home crowd thanks to his Swansea connections, making a fine block to deny Mendez-Laing.
From the resulting Marlon Pack corner, the ball looped off Aden Flint's shoulder and on to the top of the bar.
When substitute Gary Madine headed straight at Daniel Bentley late on, Bristol City could celebrate their first win at Cardiff in 17 years.