Agen assured themselves of a place in the top flight of French rugby next season with a hard-fought 29-19 victory over La Rochelle on Friday.
The result also means that relegation is near-unavoidable for La Rochelle.
In a ding-dong battle that went right down to the wire, Agen secured victory in the very last minute when Sylvère Tian broke clear for a counter-attacking try.
With the La Rochelle pack camped on the Agen line an pushing for the penalty try that would hand them a Top 14 lifeline, Tian latched onto a loose ball before bursting clear, hacking ahead twice before scoring and effectively ending La Rochelle's stay in the top flight after a single season.
It was a heartbreaking night all-round for the hosts who also saw the TMO refuse two tries.
Agen led 13-12 at half-time thanks to a try from Tongan lock Lisiate Fa'aoso before La Rochelle replied in the second period through kiwi loose forward Piula Faasalele
If Brive pick up a losing bonus point in Biarritz on Saturday, La Rochelle will officially be relegated.
For La Rochelle:
Pens: Goosen 4
Tries: Fa'aoso, Tian
Cons: Barnard 2
Pens: Barnard 5
Yellow cards: Machenaud (Agen); Senekal (Agen); Grobler (La Rochelle)