Marvin Emnes was the derby day hero as his late strike sunk the Bluebirds in this south Wales derby.
The on loan Middlesbrough forward popped up with the winner 15 minutes from time as he picked out the bottom corner to beat Tom Heaton in the Cardiff goal.
Both sides had their chances but the Swans edged this contest overall. Craig Bellamy, however, could have snuck a leveller late on with two headers wide of the target.
The Swans welcomed back Garry Monk and Mark Gower for the south Wales derby against Cardiff.
Captain Monk returned from a one-game suspension while Gower regained full fitness following a hamstring injury.
Ashley Williams became the new record holder for most consecutive league appearances by an outfield player - 107 - while Alan Tate reverted back to full-back.
Kemy Agustien had also shaken off a knee injury to be named amongst the substitutes.
Cardiff:Tom Heaton, Kevin McNaughton (Darcy Blake, 72'), Mark Hudson, Gabor Gyepes, Lee Naylor, Seyi Olofinjana, Peter Whittingham, Daniel Drinkwater (Jason Koumas, 82'), Andrew Keogh (Chris Burke, 58'), Craig Bellamy (C), Michael Chopra.
Not Used: David Marshall (GK), Gavin Rae, Stephen McPhail, Adam Matthews.
Swans:Dorus de Vries, Angel Rangel, Garry Monk(C), Ashley Williams, Alan Tate, Joe Allen, Mark Gower, Andrea Orlandi (Kemy Agustien, 82'), Nathan Dyer (Neil Taylor, 90+2'), Scott Sinclair, Marvin Emnes (Stephen Dobbie, 82').
Not Used:Yves Makabu-Makalambay (GK), Jazz Richards, David Cotterill, Craig Beattie.
Attendance: 26,049 Away: 1,784
Referee: M Jones
The atmosphere inside this stadium was electric as the clock ticked down to kick-off for what was dubbed the biggest south Wales derby of all time.
The passion is one that other derbies would certainly struggle to match and, with both sides flying high in the Championship, this encounter had extra spice.
Swansea got the game underway but for the first three minutes the Bluebirds saw plenty of the ball, and when Michael Chopra was grounded by Andrea Orlandi it gave the Bluebirds an early chance to get the ball into the box.
Peter Whittingham's delivery was flicked on by Mark Hudson and into the safe hands, but in the proceeding moments the Swans really came to life.
Scott Sinclair saw his shot deflect wide for a corner from Andrea Orlandi's initial flag-kick, while Marvin Emnes' goalbound effort from Nathan Dyer's cutback was helped over the top by Hudson.
The roles had reversed for when the Swans were handed their best chance of the early exchanges when home 'keeper Tom Heaton was forced into saving from Dyer's drive on 20 minutes, but Cardiff came close themselves as Whittingham drilled a stinging strike just beyond the post less than a minute later.
The Swans went straight back down to the other end when Sinclair's pace and slick movement down the left opened things up for him to centre, Emnes connecting with a header that dropped over the bar, while Orlandi saw another drive deflect wide for a corner on 25 minutes.
Orlandi pulled another shot across Heaton's path on the half-hour and the former Barcelona youngster was holding his own in the centre of the park, and also came close again with just six minutes left to play before the break.
The home crowd felt they should have had a penalty five minutes before the break when Michael Chopra's shot was blocked by Alan Tate - the ball struck the chest of the defender but cries of handball circled around the stadium - and while the Swans finished the half strongly it ended goalless after 45 minutes.
Half-Time: Cardiff 0 Swans 0
The Swans made a tidy start to the second period and within minutes of the re-start the 1,784 travelling supporters thought that they had a goal to celebrate.
A sweeping counter attack down the right orchestrated by the pace of Nathan Dyer picked out Marvin Emnes in the box, he played back to Orlandi who in turn picked out Sinclair. The 11-goal top-scorer skipped two challenges before firing low towards the bottom corner, Tom Heaton got a slight touch and helped it onto the post.
Dyer shot wide with 51 minutes on the clock while Heaton came to the Bluebirds' rescue again moments later when he parried Joe Allen's low strike from 25-yards.
Cardiff introduced Chris Burke just before the hour but the Swans continued to dominate this contest and on 62 minutes Heaton made another important stop, this time from Mark Gower's free-kick which the former Manchester United stopper tipped wide at his right-hand post.
He was also at hand to pull off another fine stop on 64 minutes when he deflected Sinclair's snap shot wide, but as he collected the corner he sent the ball downfield where Craig Bellamy was quickest to react, pouncing on the ball but firing straight at Dorus de Vries.
And all of that pressure paid off as the Swans took a deserved lead with 15 minutes left on the clock - Joe Allen played in Marvin Emnes, the on loan Middlesbrough forward turned his marker and fired a sweet strike beyond Heaton and into the bottom corner.
He attemped to make it two when he fired another strike wide with 10 left on the clock which proved to be his final involvement as Stephen Dobbie was introduced in his place. Kemy Agustien was also thrown on in place of Orlandi.
Cardiff were throwing bodies forward in a bid to grab an equaliser and with 60 seconds left of normal time Bellamy connected with Burke's cross but flashed his header wide from six-yards.
The Wales international also had a glorious chance deep into four minutes of injury time to level but sent another close-range header wide - and that was the final piece of action as the referee called time on this thrilling south Wales derby.