Despite a further try for Cardiff from wing Will Jones, precise kicking from home fullback Jordan Williams, along with a try from centre Nick Reynolds and a penalty try, gave the Scarlets a narrow 24-20 lead as the clock ran down.
But a 78th minute score for Cardiff's other winger, Tom Williams, gave his side a three-point advantage. Even then, there was time for more drama as the hosts won a penalty deep into injury time on the visitors' 22.
Instead of kicking for goal to secure a draw, the hosts chose to go for glory and kicked to touch. The gamble paid a handsome return as, from the resultant line-out, Wales Under 20 prop Lee crashed over for what proved to be the match-winning score.
Top-of-the-table Aberavon secured an important win in their bid for the Premiership title as they overcame high-flying Cross Keys at Pandy Park. The visitors took a 25-6 half-time lead thanks to two tries from Richard Thomas and another from Darren Ritchie.
And there were no further points in the second period as the Wizards retained their points difference lead over Neath at the top of the table, who secured a 20-15 win at Pontypridd. Keys are now eight points adrift of the leaders in fifth.
Aaron Bramwell and Gareth McCarthy both scored tries for Neath, but it was David Langdon's boot that made the difference, the fly-half adding two conversions, a penalty and a drop goal. Matthew Nuthall and Craig Locke grabbed consolation scores for Ponty.
Llandovery moved into third place, one point behind the leaders, with a nine try demolition of Tonmawr. Brothers Adam and Arran Warren both scored twice as did fly-half James Garland in a game where both defences struggled.
The Drovers eventually racked up a 62-31 win with three further tries and Garland adding the extras with his boot. Tonmawr may have been comfortably beaten but there was the small consolation of a bonus point for scoring four tries. Steffan Andrews scored twice but the home side were always up against it.
Four-try Newport surged clear in the second half of their clash with Swansea. The Black and Ambers led 13-9 at half-time but eventually secured a bonus point victory 32-21. Luke Plummer and Darren Waters were among their scorers.
Meanwhile, Carmarthen Quins eased to a comfortable five-try, 35-20 win over Bedwas. Tries from Jason Harries, Alex Pickersgill (2) and Aled Thomas (2) gave the hosts a comfortable success.