Fernando grabbed the winner in the 98th minute following a foul by defender Herita Ilunga on playmaker Marouane Chamakh.
Bordeaux's victory was deserved since they dominated most of the match although they were clumsy in front of goal.
Chamakh came close to opening the scoring in the 68th minute but St Etienne goalkeeper Jody Viviani saved the midfielder's 15-metre strike.
Viviani made a dramatic save in the last minute, stopping a close-range shot from number nine Jean-Claude Darcheville.
The win means Bordeaux, who have lost ground in the title race, keep alive their hopes of European football next season.
They are eighth in Ligue 1, trailing second-placed Racing Lens by six points before the last round of matches this weekend ahead of the winter break.
St Etienne suffered their second defeat of the season at Chaban Delmas following their 1-0 reverse in a Ligue 1 outing.
On Wednesday, Cup holders Nancy visit Olympique Lyon aiming to upset the Ligue 1 leaders on their home ground.
More from rediff