Cardiff's lead at the top of Championship was cut to five points as Middlesbrough recorded just their second win of 2013.
Kieron Dyer opened the scoring with his first league goal since 2007 from Ishmael Miller's pull-back.
Sammy Ameobi then marked his debut with some neat footwork and a curling effort from inside the box to give Boro a deserved two-goal half-time lead.
Aron Gunnarsson's second-half header gave Cardiff hope but Boro held on.
Winger Ameobi arrived on loan from Newcastle just five days ago and he proved an instant success at the Riverside.
The 20-year-old England Under-21 international was a threat throughout the opening period, as was Dyer, 34, who tapped in the opener from Miller's pass across the six-yard box.
The lead was no less than the hosts deserved following a bright opening and they doubled their lead three minutes later.
Ameobi prised open the visiting defence with some delightful footwork in the penalty area before sending his shot past David Marshall, setting a new club record of 20 scorers in a league season in the process - although the Cardiff goalkeeper may have wondered why defender Andrew Taylor opted to duck below Ameobi's shot.
Ameobi continued to bewilder the visiting defenders and he again combined well with Dyer but this time Marshall was equal to the latter's effort.
At the other end Peter Whittingham underlined Cardiff's threat with a snap right-footed effort that prompted an equally instinctive save from Jason Steele.
Cardiff boss Malky Mackay sent on Ben Nugent for McNaughton for the second period in response to first-half events while Tommy Smith also made way for Heidar Helguson after the break.
But it was Helguson's fellow Icelander Gunnarsson who brought the Bluebirds back into the contest.
Craig Bellamy, who had been well marshalled by the home defence, whipped in a cross and Gunnarsson nodded a free header past Steele in the Boro goal.
Cardiff pressed for an equaliser but Fraizer Campbell, who had scored five goals in his previous five games, missed the best chance to level, nodding Whittingham's cross wide with seconds remaining.
VIEWS FROM THE DRESSING ROOM
Cardiff City boss Malky Mackay said: "I thought we had 10 minutes in the first half where we gave two bad goals away.
"We'd started really well and finished the half really well and second half we gave everything… and really penned in Middlesbrough.
"On another day a couple of those at the end would have dropped in.
"Fraizer Campbell had a header that bounces down and just over the bar and he had the shot where he's hit the guy's hand and the referee's said it's too close for him to give a penalty.
"But the ball's going into the net so on another day it could have been a draw."