Aled Davies scored the home side's only try - his first of the season - with Callum Sheedy converting, handing Leinster their fourth defeat of the campaign.
Cardiff, boosted by the return of internationals Ben Thomas, Mason Grady, and Liam Belcher after release from Wales' camp on Monday, moved up to third in the table under their South African coach Corniel van Zyl.
The first half was cagey, with Sheedy slotting the only points as Cardiff went into the break 3-0 ahead. The decisive moment came in the 54th minute when Grady made a break down the touchline, offloading to Dan Thomas, who set up Davies to cross.
Leinster, down to 14 men late after Jacob Beetham's sin-bin, finally breached the Cardiff line through Luke McGrath, with Charlie Tector converting - but it proved too little, too late.