Nick Evans inspired a young Harlequins side to victory as they secured a home draw in the semi-finals of the LV= Cup.
The former All Blacks fly-half contributed 18 points with a try, two conversions and three penalties as Quins overcame a Cardiff side that had beaten the London team in their last five meetings.
Evans and scrum-half Karl Dickson, standing in for England's Danny Care, formed a half-back pairing which ripped Cardiff apart as Harlequins finished the LV= Cup group stages as the only side with a 100% record from their four qualifying games.
Victory also enabled Quins to overhaul Bath, 26-12 winners at Leicester 24 hours earlier, and finish top of Pool 4 while Cardiff failed to qualify from Pool 1.
Twenty-year-old winger Sam Smith, with his seventh touchdown in six first-team matches this season, scored Harlequins other first-half try as they wiped out an early 7-0 deficit to lead 17-7 at half-time.
Quins fell behind in the seventh minute when Blues flanker Andries Pretorious took a short pass from lock Bryn Griffiths and forced his way in from close range, with fly-half Ceri Sweeney adding the conversion. Harlequins drew level eight minutes later through Evans, who converted his own try.
Capitalising on a mistake from Sweeney, who kicked directly into touch from outside his own 22, the home side won the resulting lineout to exert a spell of pressure.
Dickson, scorer of two tries in the previous Sunday's 38-13 win over Wasps in Abu Dhabi, almost wriggled his way over after taking an opportunist tap penalty and Quins' Welsh prop Ceri Jones was hauled down a metre short before the London side opted for a scrum instead of a close-range penalty kick.
The gamble paid off with Dickson feeding Evans from the base of the scrum and the New Zealander raced through the narrowest of defensive gaps to touch down. Evans kicked Harlequins ahead with a 21st minute penalty after Cardiff, who lost centre Casey Laulala and prop Tom Davies to injury after three and 14 minutes respectively, were caught offside in front of their own posts.
Dickson was the provider again when Harlequins' grabbed their second try in the 24th minute. Producing a stunning break from inside his own half, he split the Cardiff defence wide open before handing Smith a clear 25-metre run to the line.
Harlequins, without seven regulars – Care, Nick Easter, Ugo Monye, skipper Chris Robshaw, Joe Marler, Mike Brown and George Robshaw – on international duty with England and the Saxons, had to dig deep to repel a powerful series of Cardiff attacks just before half-time.
The Blues, also badly depleted with international calls, injuries and suspension depriving them of Wales internationals Jamie Roberts, Sam Warburton, Bradley Davies, John Yapp, Leigh Halfpenny, Gethin Jenkins and Richie Rees, along with Scotland fly-half Dan Parks, continued the pressure as they dominated the second half for long periods.
But they were unable to breach a well-drilled Harlequins defence and Evans kicked further penalties in the 67th and 74th minutes to ensure his side extended their current unbeaten run to nine matches in all competitions.