The home side secured a 2-1 success that all but ends Derby's chances of making the playoffs.
It was a mistake from Derby star Wayne Rooney that sealed the game for Cardiff.
Junior Hoilett gave Cardiff the lead, before Jason Knight scored an equaliser.
But Rooney was caught in possession by Lee Tomlin and the Cardiff star scored the goal that keeps them in sixth place.
Cardiff are in the final play off spot, two points ahead of Millwall.
Derby must win their remaining two games and hope Cardiff do not win any points, while hoping other teams slip up as well.