Paul Trollope's late deadline day signing may have saved his job today as Rickie Lambert delivered two goals at New York Stadium.
Trollope was staring down the barrell of a fifth straight league defeat before Lambert showed his class to poach two goals that won the points for City.
Cardiff had a number of chances at goal during the game but all were high and wide and the two best chances if the first half saw Ben Amos called into action to make crucial saves As Rotherham threatened.
Lambert stood out all match but he was isolated for long periods and City's slow methodical build up was wasted.
Rotherham possessed a turn of pace at times that threatened to catch City out but it was a route one long throw that brought the opening goal. Amos could not take control of Greg Halfords missile on the hour and Izzy Brown finally fired home.
That weapon was used time and time again but City defended the threat and from a set piece of their own Lambert headed the side level.
Six minutes later Lambert reacted quickest to turn in the box and his shot took a wicked deflection to beat Lee Camp.
Cardiff held off timid late Rotherham pressure to record a crucial away win.
The victory lifts the club out of the bottom three and sets up a massive game on Tuesday against Derby County. The Rams losing today at home to Blackburn and in a desperate state.
Its a chance for City to show some balls and look to continue in an upward direction.
Rotherham: Camp, Fisher, Mattock, Fry, Wilson, Taylor, Halford, Frecklington, Newell (Blackstock 82), Brown, Ward
Cardiff: Amos, Peltier (Manga 88), Morrison, Richards, Connolly, Ralls (Harris 70), Noone, Whittingham, O’Keefe, Lambert, Immers
Referee: David Coote (Notts)
Attendance: 8,448 (390 City)