Ronan O'Gara's reigning Heineken Champions Cup holders avoided a dramatic last-16 exit as La Rochelle roared back to snatch victory from Gloucester with a late try at Stade Marcel Deflandre.
Despite leading for a large chunk of the second half, Gloucester were undone after a surge of pressure from the hosts saw Teddy Thomas cross in the final minutes to send the French powerhouses into the quarter-finals.
The reigning champions and 2021 finalists put the first points on the board through Antoine Hastoy's sixth-minute penalty, but Gloucester took the lead when a quick string of passes from a lineout allowed Chris Harris to cut through the defence and ground.
Billy Twelvetrees' conversion and subsequent penalty made it 10-3 to the visitors but La Rochelle quickly responded with two tries in two minutes from France internationals Pierre Bourgarit and Thomas, who chased his own kick before scooping the ball up and charging over.
Their lead was short-lived though, as Ollie Thorley's pace sparked a superb move from Gloucester that Freddie Clarke finished with an acrobatic effort to score in the right-hand corner, leaving the teams level at 15-15 at the break.
La Rochelle went back in front six minutes into the second half when Tawera Kerr-Barlow sneaked over the line but Gloucester responded once more when Twelvetrees' cross-field kick was collected by Louis Rees-Zammit who scored in the corner.
Two Twelvetrees penalties then saw the visitors move 26-22 ahead, a lead they enjoyed for a lengthy period, but despite a fantastic defensive effort in the final stages, Thomas found the winning score to break Cherry and White hearts and send La Rochelle into the final eight.
Bourgarit, Thomas 2, Kerr Barlow.
Harris, Clarke, Rees-Zammit. Twelvetrees. Twelvetrees 3.
Dulin, Thomas, Rhule, Danty, Favre, Hastoy, Kerr Barlow, Sclavi, Bourgarit, Atonio, Lavault, Skelton, Dillane, Botia, Alldritt. Wardi for Sclavi (26), Colombe for Atonio (53), Sazy for Lavault (71), P. Boudehent for Dillane (62), Tanga for Botia (55). Lespiaucq-Brettes, Berjon, Reus. Colombe (67).
Carreras, Rees-Zammit, Harris, S. Atkinson, Thorley, Twelvetrees, Varney, Vivas, Blake, Gotovtsev, Clarke, Alemanno, Ackermann, Ludlow, Clement. Chapman for Varney (27), Elrington for Vivas (62), Walker for Blake (62), Ford-Robinson for Gotovtsev (16), Jordan for Clarke (68), Thomas for Ackermann (68), B. Morgan for Clement (57). May. Ludlow (44).
Mike Adamson (SRU).