Faris Haroun scored a 76th-minute winner as Middlesbrough leapt above Cardiff and into third place following a pulsating npower Championship encounter that ended 3-2.
Haroun beat home goalkeeper David Marshall from inside the area to end Cardiff's 11-game unbeaten run, as Boro came from behind to claim victory.
Bart Ogbeche beat Marshall with a deflected effort to hand the visitors the advantage against the run of play, but Boro's ascendancy was short-lived.
Ben Turner nodded his first goal for Cardiff to restore parity before Aron Gunnarsson latched onto Kenny Miller's neat pass to slot home the hosts' second of the afternoon.
Boro drew level when Hoyte picked out Scott McDonald, who tapped home before Haroun struck the winner with 14 minutes remaining.
Both sides had early sights of goal, with Cardiff keeper Marshall saving from Ogbeche and Kyle McNaughton firing wide at the other end for the hosts.
The Bluebirds came out of the traps much quicker than their guests, and Peter Whittingham saw his effort blocked by Nicky Bailey.
But despite their positive start, the home side found themselves behind after 15 minutes amidst huge controversy.
At one end, McNaughton appeared to be bundled over by goalkeeper Jason Steele, but referee Graham Salisbury waved Cardiff claims for a penalty away and Boro quickly broke the deadlock.
Ogbeche handed the away side the lead, firing a deflected shot past Marshall from the edge of the area, leaving Cardiff manager Malky Mackay fuming on the sidelines.
Mackay's frown soon turned into a smile, however, as his team wasted no time in drawing level.
Eight minutes after falling behind, the Bluebirds capitalised on their control of the game when Whittingham's inswinging corner was flicked on at the near post by Miller and centre-back Turner rose highest to thunder a header past Steele.
Boro were convinced they should have had a spot-kick moments after the restart, when McDonald appeared to be felled by Andrew Taylor, only for referee Salisbury to remain unmoved, while Mark Hudson saw his header cleared off the line for Cardiff as the game picked up pace.
Don Cowie shot narrowly wide of the post after 33 minutes and Craig Conway followed suit seven minutes later, as the hosts pushed hard.
And the Welsh outfit's persistence paid off with seconds left of the first half, as Gunnarsson handed Cardiff the lead for the first time.
Miller ran towards goal and, despite being forced out wide, the Scot produced a deft backheel into the path of the Icelandic midfielder, who got in before Steele to poke the ball home.
After the interval Boro pressed hard for an equaliser. McDonald nodded wide of the left-hand post after 50 minutes before McNaughton blocked Ogbeche's attempt and Cardiff were only able to hold off their guests until the hour mark.
Bailey played in Justin Hoyte down the right-hand channel and the full-back squared for McDonald, who slotted home from close range.
The goal rocked Cardiff and the hosts soon found themselves behind once again.
Julio Arca played a the ball into box, Haroun stole in front of his marker and created the time and space to control the cross on his chest and volleyed past Marshall after 76 minutes.
Whittingham went close from a 25-yard free-kick as Cardiff searched desperately for a leveller, but the hosts could not find a way through before the final whistle.
Cardiff 2-3 Middlesbrough: Match Report - view commentary, squad, and statictics of the game as it happened.