The Blues will win Pool Three if they topple Memorial Stadium hosts Bristol on Sunday week.
Defeat in the west country, though, could let French champions Stade Francais through the back door. Stade’s last game is away to already-eliminated Quins.
In keeping with a side short of confidence, the visitors struggled to make headway — spilling possession at crucial times.
Their cause was not helped by flyhalf Chris Malone missing two penalties in quick succession, and the Blues made him pay as half-time approached.
Flanker Martyn Williams, the game’s most influential figure, cropped up in the right place at the right time — providing a defence-splitting pass to Hewitt, whose searing angle of attack took him clear.
Blair added the conversion, giving Cardiff a 10-0 interval lead as they looked forward to a second period with the elements firmly in their favour.
But Quins stunned them within 10 minutes of the restart, rewarding a sustained spell of pressure by claiming a well-worked converted try when Luscombe touched down.
Alarm bells were ringing, but Blair added a few penalties to ease nerves before the clinching try arrived on 71 minutes, Tom Shanklin appearing in the middle of a forward rush towards Quins’ line, collecting the touchdown under a pile of bodies.
Cardiff Blues scorers: Tries: D. Hewitt, Shanklin. Cons: Blair 2. Pens: Blair 3.
Blair, J. Roberts, Shanklin, D. Hewitt, G. Thomas, Macleod, Spice, Jenkins, G. Williams, Filise, D. Jones, Tito, Molitika, M. Williams, Rush.
Replacements: J. Robinson for D. Hewitt (77), Goodfield for G. Williams (76).
Harlequins scorers: Tries: Luscombe, Brown. Cons: Malone.
Brown, Strettle, Luscombe, Barry, Williams, Malone, So’oialo, Jones, Botha, Ross, Percival, Spanghero, Guest, Volley, Hala’ufia. Replacements: Masson for Barry (70), Jarvis for Malone (70), Fuga for Botha (70), Kohn for Percival (70), Davies for Hala’ufia (70).
Ref: R Poite (RFU).
European Challenge Cup Pool 3: Brive 12 Newcastle 19; Pool 2: Montauban 7 Worcester 24; Pool 4: Sale 45 Petrarca 6; Pool 5: Leeds Carnegie 25 Dax 18