Tries from hooker Andy Littlehill and winger Jamie Davies were enough to secure the win with fly-half Dai Langdon adding a conversion and a penalty. For Cardiff, Richard Smith crossed for a try and 18-year-old outside half Richard Patchell kicked three penalties.
There was another close encounter at Carmarthen where the mighty Quins stole victory at the death with a last gasp penalty from replacement Daniel Evans that made it 27-26. The visitors thought they had done enough to win it when full back Adam
Thomas grabbed his second try in the 73rd minute and Simon Humberstone's conversion made it 26-24 in their favour.
But there was one last push from Quins and Evans kept his cool to slot the match winning penalty to add to the earlier good work of full back Craig Everett, Jason Harris and Ricky Richards, who all grabbed tries. Full back Chris Banfield converted all three and also landed a penalty.
Cross Keys also triumphed by a single point in another Principality Premiership thriller that saw the Gwent side overtake Llanelli in the table. Their 13-12 win at Parc y Scarlets was down to the individual brilliance of outside half Steffan Jones, who scored all the visitors' points with a try, conversion and two penalties that gave Keys a 13-0 lead.
Llanelli finally came to life in the second half and crossed for two tries of their own, through replacement Bowdy Davies and flanker Mat Gilbert. But Diggy Bird only kicked one conversion, and his side came up one point short.
Aberavon ensured veteran No 8 Richard Morris had plenty to smile about on the day he became only the third player in the club's history to make 500 appearances. The Wizards romped to a comfortable 40-19 bonus-point win over struggling Newport at the Talbot Athletic Ground.
The home side picked up two penalty tries after the visitors, faced with an imposing performance from the home pack, collapsed scrums. Full back Liam Gadd also touched down, as did outside half Jamie Davies, who added a further 20 points from four conversions and four penalties.