Neil Warnock made a triumphant return to Elland Road as second-half goals from Sean Morrison and Kenneth Zohore secured Cardiff a 2-0 win against his former club Leeds.
Cardiff boss Warnock, who spent 14 months in charge of Leeds before parting company with them in 2013, did his former employers no favours in their bid for promotion by guiding his side to a well-deserved victory.
Bluebirds skipper Morrison's header was the first goal Leeds had conceded at home in 630 minutes and striker Zohore's tap-in ensured the Yorkshire club's six-game winning run at Elland Road came to a halt.
Cardiff's win lifts them clear of imminent relegation trouble and sent Leeds, who had midfielder Liam Bridcutt sent off for a second bookable offence late on, to back-to-back league defeats for the first time since September.
The first half was a largely forgettable affair as Leeds probed for the first 20 minutes without creating any clear-cut chances.
Hernandez and Spanish team-mate Alfonso Pedraza both had their moments. The latter, on loan from Villarreal and making his full debut, embarked on one run on goal after stealing possession on halfway and briefly lifted the home fans from their seats.
But for all Leeds' possession, Cardiff spurned the best chance to open the scoring in the first period when Greg Halford headed Craig Noone's 28th-minute cross straight at goalkeeper Rob Green.
Pedraza had two shots in quick succession blocked by Morrison and Luke Ayling blazed over the crossbar as Leeds laboured.
Sky Bet Championship player of the month Chris Wood saw his low free-kick comfortably gathered by Cardiff goalkeeper Allan McGregor, before successive efforts from Noone and Aron Gunnarsson in a goalmouth scramble at the other end were blocked.
Leeds began the second half at a quicker tempo and with more purpose but after centre-half Liam Cooper - deputising for a poorly Pontus Jansson - headed Hernandez's corner over, Cardiff stole into the lead.
Noone's delivered a fine, curling free-kick from the right and Morrison planted his header beyond Green to give the Welsh side a 53rd-minute lead.
Green saved at full stretch soon after from Noone's well-struck effort and the game took an a familiar pattern. Leeds hogged the ball while failing to carve open a stubborn Cardiff defence and the visitors fashioned the better chances.
Zohore headed Joe Ralls' cross just off target and although Wood fired wide after Leeds produced their best move of the game in the 67th minute, Cardiff doubled their lead.
Leeds conceded possession far too easily on the edge of their area allowing Gunnarsson to run clear on goal and the Icelander squared for Zohore to side-foot into an empty net in the 71st minute.
Leeds defender Kyle Bartley headed over, substitute Kemar Roofe fired off target and Cooper's header failed to trouble McGregor as the home side responded.
Bridcutt was shown his second yellow card for his foul on Halford in the closing stages and Leeds played out a game they will not want to dwell on with 10 men.
Leeds boss Garry Monk:
"Frustrating day and frustrating result for us. I said to the players that's something new for the group. I think it's the first time we've faced a team who have been set up to frustrate and defend very well, be hard to break down and leave no space behind them.
"We had to try and be patient and move the ball and move their shape to try and create spaces. Unfortunately we made two mistakes which cost us two goals and put us out of the game."
Cardiff boss Neil Warnock:
"We set our stall out, they're a good side. We had to be on top of our game really and I thought the first 20 minutes were really helpful, we quietened the crowd a little bit and didn't give them much space in midfield to pick the holes, which they're very good at.
"The longer the game went on the more comfortable we became. From one to 11 today we were fantastic."