Danny Ward's 85th minute goal the difference as Cardiff keep their play off push on track.
A game that looked there for the taking proved a hard slog for Cardiff before ultimately winning with a quality goal.
Bristol City have slumped in recent form and looked nervous as Cardiff, quite the opposite, were confident in their play and possession but it was a concern that the Bluebirds had not taken advantage as the first half ended with no real quality in front of goal.
As the second half wore on, as a fan watching, you felt that Cardiff might rue the lack of a goal or two as Bristol hammered ball after ball into the box. Alex Smithies produced a world class save to deny Nahki Wells and the defenders put their heads and bodies on the line to defend their goal.
Neil Harris brought Lee Tomlin on and later Danny Ward and the two of the combined for the winning goal. Benik Afobe lost possession to Tomlin and the former Bristol City player strode forward and delivered a perfectly weighted ball for Ward to strike first time on the run to find the bottom left hand corner.
City saw out the remaining five minute of normal time and six minutes added to time to record a superb victory that all but mathematically rules Bristol City out of the play off hunt. And come Tuesday Cardiff have the chance to eliminate another rival when Blackburn come to CCS (7:45pm).
That's 10 points from 12 since the restart by what is becoming an efficient machine under Neil Harris. What a job he has done.