Preston went down to their third home defeat in a row after conceding a second-half double against Cardiff at Deepdale.
After just five minutes Preston's Lewis Neal hit a left-wing corner which came out off Peter Whittingham to Simon Whaley and the midfielder struck a 20-yard shot into the bottom of the net for the third goal of the season.
Patrick Agyemang should have made it two soon after but his shot from the right from close range was saved by Cardiff goalkeeper Kasper Schmeichel.
Goalscorer Whaley had to go off with a suspected groin injury after 18 minutes and was replaced by substitute Chris Sedgwick.
Sedgwick had two headers that missed the target before Callum Davidson received his eighth yellow card of the season for a foul on Joe Ledley.
Jimmy Floyd Hasselbank had a 25-yard shot which went wide of the keeper's post after 33 minutes and Darren Carter ran through into the penalty box before having a shot deflected for a corner.
Glenn Loovens shot wide of the keeper's post just before half time and Cardiff captain Stephen McPhail curled a 20-yard shot just wide of the keeper's post just after half time.
The equaliser always looked like coming and sure enough in the 53rd minute Ledley hit a corner and Roger Johnson headed the ball low into the bottom right for his fifth goal of the season.
And the eventual winner came after man of the match Ledley robbed Davidson in his own half and outmuscled Paul McKenna before placing the ball left-footed into the top corner of the net to make it 2-1 to Cardiff.