A Stephen Jones penalty with three minutes to go helped the Scarlets to an impressive 16-13 win at Castres.
The visitors dominated the opening 25 minutes with Matt Gilbert going over to accompany a Rhys Priestland three-pointer from the kicking tee.
However, poor kicking let the French side back in the game and Rory Kockott booted two penalties to leave the Welsh region 8-6 ahead at half-time.
Aaron Shingler extended their lead in the second period and although a Yannick Forestier try levelled the scores, Jones was the hero with a 77th minute three-pointer.
The Scarlets needed Munster to overcome Northampton Saints to stand a chance of qualifying for the Amlin Challenge Cup. And with the Irish province hammering the English side in Milton Keynes, it left the door open for the Welsh.
They did themselves no harm by racing out to an early 8-0 advantage. After Priestland had uncharacteristically missed a penalty, he eventually kicked them ahead with a three-pointer four minutes later.
Number eight Gilbert, in for England Elite Player Squad member Ben Morgan, crossed the whitewash as the visitors asserted their early dominance.
Priestland continued to struggle from the kicking tee, going wayward with two further opportunities. And he was made to pay when successive Kockott penalties bought Castres to within two points at the break.
Both sides struggled to unlock each other's defences before a Shingler touchdown put the Scarlets in command. However, Forestier powered over to equalise, but Jones' late penalty sealed their passage into the Amlin Challenge Cup.
Pens: Kockott 2
Tries: Gilbert, Shingler
Pens: Priestland, Jones
Castres Olympique: 15 Romain Teulet, 14 Romain Martial, 13 Paul Bonnefond, 12 Pierre-Manuel Garcia, 11 Marc Andreu, 10 Seremaia Bai, 9 Rory Kockott, 8 Chris Masoe, 7 Steve Malonga, 6 Jannie Bornman, 5 Rodrigo Capo Ortega, 4 Scott Murray, 3 Karena Wihongi, 2 Mathieu Bonello, 1 Saimone Taumoepeau.
Replacements: 16 Brice Mach, 17 Yannick Forestier, 18 MichaÃ«l Coetzee, 19 Matthias Rolland, 20 Yannick Caballero, 21 Thierry Lacrampe, 22 Pierre Bernard, 23 Max Evans.
Scarlets:15 Rhys Priestland, 14 George North, 13 Scott Williams, 12 Jon Davies, 11 Liam Williams, 10 Stephen Jones (capt), 9 Rhodri Williams, 8 Matt Gilbert, 7 Johnathan Edwards, 6 Aaron Shingler, 5 Dominic Day 4 Lou Reed, 3 Peter Edwards, 2 Ken Owens, 1 Phil John.
Replacements: 16 Emyr Phillips, 17 Iestyn Thomas, 18 Rhodri Jones, 19 Sione Timani, 20 Richie Pugh, 21 Gareth Davies, 22 Gareth Maule, 23 Viliame Iongi.
Venue: Stade Pierre Antoine, Castres
Referee: 'JP' Doyle