Scarlets held on for just their third United Rugby Championship win of the season as they overcame Cardiff in a thrilling Welsh derby.
Scarlets led 19-10 after a breathless first half with tries for Dane Blacker, Johnny McNicholl and Jonathan Davies, with Taulupe Faletau scoring in reply.
Cardiff fought back as Rhys Carre and Josh Adams crossed after the break.
But the visitors kept themselves just out of reach thanks to the boot of ex-Cardiff full-back Leigh Halfpenny.
Scarlets remain second from bottom in the URC but this was a significant result for the Llanelli-based region, who had only picked up their second league win of the season against the Dragons on New Year's Day.
As for Cardiff, they slip down to 10th in the table but remain within striking distance of the play-off places.
Wales head coach Warren Gatland was watching from the stands and, less than a month until he begins his second tenure with a Six Nations opener against Ireland, the New Zealander will have been encouraged by the entertainment on offer at the Arms Park.
This was a match-up littered with intriguing head-to-head duels as well as several players facing their former employers, with Wales internationals Halfpenny, Liam Williams and Rhys Patchell among those to have represented both these teams.
It was one of the less heralded exes who first caught the eye, though, as former reserve Cardiff scrum-half Blacker took a quick-tap penalty and scooted over for the game's opening try after three minutes.
That score was typical of a vibrant start to this encounter, with Blacker's try and Halfpenny's conversion cancelling out Jarrod Evans' second-minute penalty.
Owen Lane threatened for Cardiff with a galloping run down the right wing, while Joe Roberts got the Scarlets going by stripping the ball in midfield and haring towards the hosts' 22.
After offloading possession, the young centre was then struck on the head by the shoulder of Cardiff lock Lopeti Timani, who was fortunate only to receive a yellow card for his tackle.
As aggrieved as the Scarlets might have felt, they still made hay by scoring 12 points during the 10 minutes when their opponents were down to 14 men.
Their second try was a well-measured exploitation of their numerical advantage, with number eight Carwyn Tuipulotu and lock Sam Lousi making telling contributions before the ball was worked to the right wing, where McNicholl dived over.
Less than two minutes later, the Scarlets struck again. Patchell glided through Cardiff's defence and passed to McNicholl, whose kick seemed to be overhit but bounced backwards favourably for captain Davies to touch down.
Suddenly, Cardiff found themselves 19-3 down but, once Timani returned from the sin-bin, the home side hit back as Faletau picked up the ball from the back of an advancing scrum and powered over for a try well converted by Evans.
The second half started with a Halfpenny penalty and then a second long deliberation between referee Joy Neville and television match official Brian MacNiece.
This time it was Scarlets prop Steff Thomas under scrutiny for a tackle on Thomas Young which saw him make head-on-head contact with the Cardiff flanker.
Like Timani earlier, Thomas was lucky to only leave the field for 10 minutes and, like the Scarlets on that occasion, Cardiff made their man advantage count immediately as prop Carre bulldozed his way over.
Halfpenny's second penalty nudged the Scarlets ahead 25-17 but, with the home crowd roaring their team on, Cardiff kept coming.
Their third try was a peach, with fluid phase play setting the platform for Ben Thomas to dink an inch-perfect cross-field chip into the arms of Adams, who sped to the line to set up a grandstand finish.
Another three points from Halfpenny extended the Scarlets' lead to 28-22 and, despite the late and desperate efforts of their opponents, Dwayne Peel's men dug in for a precious victory.
Cardiff director of rugby Dai Young:
"I thought both physically and mentally we weren't at our best. Uncharacteristically we made a lot of errors, which I thought we'd taken out of our game.
"I won't take anything away from the Scarlets. I thought they were the better team and had more control.
"We showed in patches what a threatening team we can be but we lacked control, certainly in the first 30 minutes when we struggled to get past three or four phases. It was disappointing."
Scarlets head coach Dwayne Peel:
"We're delighted with the win. This was a big game for us. The team talk this week was done by Jon [Davies] and Ken [Owens] when they spoke about backing up last week's win [over the Dragons].
"We knew the physical exchanges would be huge, especially the breakdown, and I felt we applied ourselves well there, started brightly and, when we got on top with the ball, we were creating problems.
"The big thing for us is managing to get a bit of consistency around selection. Sometimes the hard work you're doing, you don't see the benefits and now, after a couple of wins, you get a bit of confidence and momentum off the back of it."
Cardiff: Liam Williams; Owen Lane, Rey Lee-Lo, Ben Thomas, Josh Adams; Jarrod Evans, Tomos Williams; Rhys Carré, Kirby Myhill, Dmitri Arhip, Lopeti Timani, Seb Davies, Josh Turnbull (capt), Thomas Young, Taulupe Faletau.
Replacements: Efan Daniel, Corey Domachowski, Keiron Assiratti, Teddy Williams, Ellis Jenkins, Lloyd Williams, Rhys Priestland, Mason Grady.
Scarlets: Leigh Halfpenny; Johnny McNicholl, Joe Roberts, Jonathan Davies (capt), Steff Evans; Rhys Patchell, Dane Blacker; Steff Thomas, Ken Owens, Javan Sebastian, Vaea Fifita, Sam Lousi, Aaron Shingler, Dan Davis, Carwyn Tuipulotu.
Replacements: Shaun Evans, Kemsley Mathias, Sam Wainwright, Morgan Jones, Tomás Lezana, Gareth Davies, Dan Jones, Ioan Nicholas.
Referee: Joy Neville (IRFU)
Assistant referees: Gareth Newman (WRU), Gwyn Morris (WRU)
TMO: Brian MacNeice (IRFU)