Neil Warnock's 100th game in charge of the Bluebirds looked set to end in disappointment after a hugely frustrating second half saw struggling Cardiff fail to break down their outnumbered visitors for long periods.
Brighton led early through Lewis Dunk's header but were pegged back by a Callum Paterson equaliser and soon had Dale Stephens sent off, leaving Chris Hughton's men to play the final hour a man down.
The Seagulls still looked as though they would emerge from the match with a hard-earned point until Bamba - at fault for Dunk's opener - scrambled the ball into the net in the 90th minute for a potentially vital winner, lifting Cardiff out of the relegation zone.
FULL TIME: #CardiffCity 2-1 @OfficialBHAFC— Cardiff City FC (@CardiffCityFC) November 10, 2018
The 10-man visitors fought valiantly, but the #Bluebirds finally find a way through in added time to secure all three points! Get in! #CARBHA #CityAsOne pic.twitter.com/D662xbLxqL
Cardiff started on the front foot but paid the price for some lax defending from Brighton's first attack as Dunk was left with time and space to nod Solly March's free-kick into the net.
But another header had Cardiff level before the half-hour, the game turning as Paterson profited from a deflected cross that took out two defenders and dropped kindly in front of goal.
The visitors were soon down to 10 men when Stephens careered into Greg Cunningham after a loose touch and the Bluebirds assumed complete control of the contest, hitting the bar through Kadeem Harris after the restart.
Jose Izquierdo threatened to steal the points on the break as Neil Etheridge made a smart stop, before a frantic finale saw Brighton defending on their own goal line.
An initial scramble broke clear but Cardiff attacked again and, when the ball bounced away off the post and Justin Hoilett miscued, Bamba was waiting to smash into the roof of the net.
What does it mean? A big, big Bluebirds win
Having drawn 0-0 against 10 men when facing relegation rivals Newcastle United and Huddersfield Town, it was imperative Cardiff did not let another opportunity slip. That they almost did matters little now as Warnock's men are lifted out of the bottom three and potentially able to carry some momentum forward. This must be a building block.
Bamba from zero to hero
Cardiff struggle to score goals and so Bamba's early error - allowing Dunk to ghost in and score - looked as though it would prove costly. But after seeing his team-mates fail to find a second-half breakthrough, Bamba made amends. More forward-thinking Cardiff players squandered big chances in the build-up, before the defender rifled home.
Red costs Hughton's men
Stephens' red card will be debated long and hard by supporters of both sides, but there was certainly an argument to be made for it, the midfielder out of control after winning a prior challenge. It was a tackle Stephens did not need to make and it cost Brighton. They had been the better side until that stage and were condemned to a desperate defensive effort.
Key Opta Facts
2 - This is the second time a Neil Warnock side have won in the 90th minute of a Premier League game, and the first time since September 2006 (Phil Jagielka for Sheff Utd v Middlesbrough). Drama. #CARBRI pic.twitter.com/6dKyKMphTj— OptaJoe (@OptaJoe) November 10, 2018
- This is the second time a Neil Warnock side have won in the 90th minute of a Premier League game, the first occurrence coming in September 2006 when Phil Jagielka scored for Sheffield Utd vs Middlesbrough.
- Brighton have won just one of their last 20 Premier League matches away from home (D5 L14), with that victory coming against Newcastle last month.
- Cardiff have conceded the first goal of the game on more occasions than any other team in the Premier League this season (9).
- Eleven of Lewis Dunk’s 13 league goals for Brighton have been headers