LLANELLI still have an outside chance of cinching a place in the play-offs after this win in an entertaining encounter at the Arms Park.
The Parc y Scarlets side still need other results to go their way. But while they are fifth in the table, they are only six points adrift of third-placed Llandovery.
The returning Steve Shingler gave the visitors the lead with a penalty, though that was cancelled out as Dafydd Hewitt charged down a kick and dropped on the ball over the line.
Dean Gunter added a penalty shortly after to extend the lead.
Llanelli got back in front when a maul was dragged down short and they were awarded a penalty try. Gunter restored the advantage before Shingler gave Llanelli the lead back just before half-time.
Shingler extended the lead early in the second half but two Gunter penalties gave Cardiff a slim advantage.
Dion Jones scored a fine individual try for the visitors and Josh Adams added a third try for Llanelli three minutes later as Llanelli ran the ball at every opportunity.
A Gunter try drew Cardiff back into the game but a late penalty by Jones gave Llanelli the points.
Cardiff : Tries: D. Hewitt, D. Gunter. Con: D. Gunter. Pens: D. Gunter (4).
Llanelli : Tries: Pen try, D. Jones, J. Adams. Cons: S. Shingler, D. Jones. Pens: S. Shingler (3), D. Jones.