Harlequins sealed a home quarter-final in the European Challenge Cup after withstanding a battling second-half comeback from Cardiff to seal a 34-26 victory over the Blues.
With former Cardiff star Jamie Roberts in their ranks, Quins looked to be cruising to a fifth straight Pool Three win as tries from Rob Buchanan, Jack Clifford, Marland Yarde and Ross Chisholm, all converted by Nick Evans, gave them a 28-0 half-time lead.
But a spate of substitutions early in the second half appeared to weaken the home side, with England trio Joe Marler, Danny Care and Nick Easter and highly-rated hooker Buchanan, who signed a new contract earlier this week, among those to make way.
Cardiff capitalised as Cory Allen, Dan Fish and Lloyd Williams all crossed the whitewash, with Rhys Patchell adding the extras to two of those scores, and by the time Fish scored his second try after 71 minutes, the visitors trailed 31-26.
But replacement Ben Botica's penalty on the whistle ensured Quins maintained their 100 per cent record in the pool stage and they secured a tie at Twickenham Stoop in the last eight.
The Blues, who collected a losing bonus point, need to beat Calvisano at Cardiff Arms Park next Friday and hope Quins defeat Montpellier to have a chance of reaching the knockout stages.