Mark McMillan made a try-scoring debut for Glasgow to ensure the Warriors got their pre-season campaign off to a winning start in the XV Challenge Vaquerin tournament.
Sean Lineen's men ran in four tries as they defeated Castres despite missing a host of Scotland internationals.
Edinburgh Accies winger Chris Kinloch cancelled out Castres's early try and Daryl Gibson – bound for Canterbury to become assistant coach - did likewise as Glasgow again drew level.
Castres once again took the lead but Hefin O Hare crossed to bring the Warriors to within two points at 21-19.
Lineen's side secured victory thanks to a late try by McMillan, who signed from Wasps at the end of last season. Colin Gregor kicked the extras to make it three out of four conversions.
Scotland number eight Johnnie Beattie was only a replacement after his exertions with the A team over the summer while Test centre Andrew Henderson also spent much of the game on the bench.
Dan Parks, Kelly Brown, Dougie Hall and John Barclay played no part in the match as they build up their fitness following Scotland's tour of Argentina in the summer.