|Harlequins (22) 36|
|Tries: Dombrandt 3, H Jones, Taulani Con: Allan 3, Smith Pen: Allan|
|Castres (23) 33|
|Tries: Barlot, Zeghdar, Kockott, Nakosi, Cocagi Con: Botica Pens: Botica 2|
Harlequins produced yet another late comeback as Alex Dombrandt completed his hat-trick with the clock deep in the red to decide a 10-try thriller against Castres.
French side Castres, playing for their place in the last 16, seemed set to hold out after a strong second half.
But roared on by the Stoop and with fly-half Marcus Smith off the bench, the hosts found a way once more.
Dombrandt tapped and went from close in and squirmed over in the 85th minute.
His score survived a review by the video official with the visitors certain that it was either short of the line or not properly grounded.
But referee Mike Adamson ruled in Quins' favour to settle a rollercoaster encounter and the celebrating home fans spared little time on the visitors' sense of injustice.
The victory completes a clean sweep of Harlequins' Champions Cup pool games, with their first appearance in the knock-out stages since 2013 already assured before kick-off.
Harlequins will discover their last 16 opponent after this weekend's round of matches.
The late, late show on repeatSmith came on as a 66th-minute replacement for Tommaso Allan
Harlequins have a happy habit of starting slow and finishing strong.
Last weekend, they reeled in Cardiff, 14 points clear in the second half, to snatch victory.
The previous two weeks had featured domestic come-from-behind wins over Exeter and Gloucester.
And, to the frustration of head coach Tabai Matson, once again Harlequins gave themselves it all to do.
Straight from kick-off, a mix-up between Dombrandt and Viliami Taulani gave Castres' Ben Botica a penalty and the game's first points.
Hooker Gaetan Barlot raced over from a trick-play line-out in the third minute and former France Sevens star Antoine Zeghdar followed as Harlequins' defence left him free to stroll in from close range.
Thirteen points adrift after just 10 minutes, the hosts were belatedly stung into action.
Dombrandt dived into the corner, surviving Adrea Cocagi's cover tackle to score, before Huw Jones profited from the chaos caused by Tommaso Allan's delicate grubber and Andre Esterhuizen's full-blooded chase.
When Taulani barged over for an emotional score in a week in which his native Tonga has suffered so much, Harlequins had repaired the damage and seemed to have the contest under control.
But Joe Marler's needless stamp on scrum-half Rory Kockott's hand after the whistle flipped the momentum once more.
The Harlequins prop was dispatched to the sin-bin and his victim sliced through to score a minute later after a burst down the blind side from Nakosi.
Castres led at the break and, despite Dombrant lurking wide to grab his second shortly after the restart, had the upper hand for much of the second half as Cocagi and powerhouse wing Filipo Nakosi got the tries their performances deserved.
The visitors, with the added incentive of putting holders and local rivals Toulouse in danger of elimination, looked set to see out Quins' late pressure.
But their defence, coached by England 2003 Rugby World Cup winner Joe Worsley, eventually folded as Dombrandt underlined his case for more game time with England over the coming weeks.
Harlequins: David; Lynagh, Jones, Esterhuizen, Murley; Allan, Steele; Marler, Musk, Kerrod, Lamb, Tizard, Taulani, Wallace, Dombrandt (capt)
Replacements: Riley, Garcia Botta, Wilson, Hammond, White, Gjaltema, Smith, Marchant
Castres: Larregain; Zeghdar, Aguillon, Cocagi, Nakosi; Botica, Kockott; Tichit, Barlot, Guillamon, Vanverberghe, Whetton, Champion de Crespigny, Kafatolu, Kornath
Replacements: Ngauamo, Nostadt, Tierney, Hannoyer, Raisuqe, Fernandez, Le Brun, Botitu
Referee: Ref: Mike Adamson (Scotland)