Worcester Warriors were knocked out of the European Challenge Cup after squandering a 15-point lead to lose at home to French Top 14 side Castres.
A bonus-point win would have put Warriors in the quarter-finals, but Dragons' victory over Enisei-STM means the Welsh team go through with Castres.
Worcester looked set to progress when tries from Jamie Shillcock, Marmo Mama and Michael Heaney put them 27-12 up.
But Rory Kockott's hat-trick inspired a Castres comeback at Sixways.
South Africa-born scrum-half Kockott, capped 11 times by France, scored 23 of the visitors' points as the second-half turnaround ensured they finish as Pool One winners.
Wilfrid Hounkpatin and Baptiste Delaporte also touched down for Castres.
Worcester Warriors: Shillcock; Humphreys, Lawrence, Beck, David; Weir, Heaney; Waller, Moulds, Schonert, Bresler, G Kitchener, Hill, Mama, Du Preez.
Replacements: Taufete'e, Bower, Palframan, A Kitchener, van Velze, Kitto, Venter, Pennell.
Castres: Palis; Nakosi, Vialelle, Ebersohn, Paris; Fortunel, Kockott; Tierney, Firmin, Hounkpatin, Samson, N'Kinsi, Gerondeau, Jelonch, Tulou.
Replacements: Jenneker, De Benedittis, Kotze, Gimeno, Delaporte, Radosavljevic, David, Dumora.
Referee: Ben Blain (Scotland)
For the latest rugby union news follow @bbcrugbyunion on Twitter.