Gethin Jenkins is tackled by Benjamin Kayser and Seremaia Bai
Cardiff Blues salvaged an important losing bonus point at Castres thanks to a last-minute try by Scott Andrews.
The Welsh team looked set to leave Stade Pierre Antoine empty-handed as they trailed 27-13 with the full-time whistle rapidly approaching.
However replacement prop Andrews barged his way over from close range to claim Cardiff's second try, converted by Ceri Sweeney to clinch the single point.
Castres had stormed into a 27-6 half-time lead after both wingers scored.
Vincent Inigo and Marc Andreu each crossed for slick tries and things looked bleak for the visitors until Ma'ama Molitika sparked a second-half recovery.
And Cardiff coach Dai Young would have left France reasonably content after his team had been a poor second-best in the opening half.
Castres were on the front foot from the start and opened the scoring thanks to a Romain Teulet penalty.
The full-back landed another two penalties either side of a Seremaia Bai drop-goal before Ben Blair struck with Cardiff's first points.
The goal-kicking full-backs exchanged further penalties to bring the score to 15-6, only for the French side to land a telling blow after 36 minutes when Inigo danced through the visitors' defence.
He pounced on a speculative Yoan Audrin kick after the bounce beat the visitors' defence and burst through the gap before skipping past the covering Leigh Halfpenny to score.
Teulet converted to give the side a 22-6 lead and things got even worse for Cardiff when Inigo's wing partner grabbed a try of his own minutes later.
Audrin was at the centre of the action again and burst down the Cardiff wing. The ball was spread wide to Teulet who chipped to the corner for Andreu to score, giving the hosts their commanding half-time lead.
Castres centre Yannick Caballero is tackled by Blues star Tom Shanklin
But Cardiff played with increased intensity after the interval.
Wales centre Tom Shanklin started a good move which released substitute Tom James. He was tackled high with the try line at his mercy but was able to recycle the ball.
Richie Rees popped to Tonga international Molitika who drove through two defenders to score. Sweeney converted to pull the Blues back to 27-13.
Cardiff continued to threaten as the hosts concentrated on protecting their lead.
Eventually, Andrews drove his way through the Castres defence with the help of Sam Warburton, for the point that made a difficult night for the visitors end on a more positive note.
Castres: Teulet, Inigo, Audrin, Baikeinuku, Andreu, McIntyre, Tillous-Borde, Forestier, Kayser, Ducalcon, Tekori, Rolland, Diarra, Caballero, Masoe. Replacements: Bernard for Andreu (73), Sanchou for Tillous-Borde (71), Bonello for Kayser (54), Saayman for Ducalcon (72), Murray for Caballero (73), Bornman for Masoe (59).Not Used: Giorgadze, Garcia.
Sin Bin: Sanchou (79).
Cardiff Blues: Blair, Halfpenny, Laulala, Shanklin, Czekaj, Sweeney, Rees, Jenkins, Thomas, Filise, B. Davies, Jones, Molitika, Warburton, Rush. Replacements: James for Blair (42), R. Williams for Thomas (28), Tito for Jones (69), Pretorius for Molitika (69), Andrews for Filise (72). Not Used: Yapp, L. Williams, Hewitt.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.