Malky Mackay thought his side should have had a leveller.
"I felt we probably deserved a point on the basis of that second half performance," he said.
But he admitted the Championship leaders had been the architects of their own downfall.
"We shot ourselves in the foot a bit and we gave away two goals which we would normally never concede and that made it very difficult.
"But we put in a spirited second half and we got one back and to be honest we had enough chances to have got the leveller."
Winning manager Tony Mowbray was happy to get a win after a poor run of form.
"The character got us through," said Mowbray, whose side had taken just four points from nine games and slipped out of the play-off places in a torrid start to 2013.
"Sometimes when you have been on a run like we have you forget how to win football matches.
"It has been a tough run and sometimes we haven't got what we deserved but we worked and we battled and showed real character and we got through in the end.
"Cardiff gave us a lot of problems in the second half. They had some big lads in our box and at times it was like Land of the Giants. It was frantic at the end but we got there."