Striker Robert Earnshaw scored twice as Cardiff secured a 2-1 win at Colchester - their sixth away win of the season.
Colchester more than matched their promotion-chasing rivals in the first half, with City goalkeeper Neil Alexander denying Kevin Rapley and Dean Morgan.
Cardiff almost broke the deadlock a minute before the break when Andy Campbell drove narrowly wide after a neat move involving Peter Thorne.
Cardiff did take the lead before the break when Earnshaw turned quickly and scored with a surprise left-foot shot just inside the near post - although there was a suspicion he had controlled the ball with his hand.
The home side were on level terms eight minutes into the second half when Cardiff defender Spencer Prior stumbled to let in veteran Micky Stockwell. He went through unopposed to score from close range.
Alan White and Kem Izzet were both booked before Colchester`s Rapley and Cardiff`s Fan Zhiyi were sent off following a clash near the byline.
U`s goalkeeper Simon Brown pulled off four stunning saves to deny Graham Kavanagh twice, Andy Legg and Prior.
The game looked set to finish all square before Earnshaw conjured a goal out of nothing in the 77th minute. He tried a speculative lob which completely deceived Brown, the ball rebounding in from the far post.