Stephen Pearson's second-half strike ended Southampton's 25-match unbeaten home league record and saw Bristol City pull away from the relegation zone.
The Saints had the chance to move six points clear at the top of the Championship.
But Pearson converted 11 minutes from time to give the Robins their first victory in six matches.
City striker Nicky Maynard had a goal disallowed for offside, and David James pulled off several fine saves.
The victory for Derek McInnes' side sees them move three points clear of the bottom three.
It was a scrappy game at St Mary's with the best chances falling to Rickie Lambert in the first half. Steve De Ridder raced down the right wing and after pulling the ball back to Lambert, the striker failed to manoeuvre an effort on target.
City on a run
- Bristol City have won the last four games against Southampton, including a league double this season.
Midfielder Jack Cork shot over from 25 yards before Morgan Schneiderlin tested former England goalkeeper David James, who had to tip the long-range strike over the crossbar.
From the resulting corner, Lambert rose high at the back post but could only head over.
Albert Adomah tested Saints' goalkeeper Kelvin Davis after stealing the ball off Adam Lallana but his shot was turned around the post.
Then City thought they had taken the lead on 53 minutes after Davis parried Kalifa Cisse's strike into the path of Maynard. The highly-rated striker converted the rebound neatly but was deemed to be in an offside position.
The Robins were close to going in front again through Pearson after 73 minutes but his weak effort was kept out by Davis.
Pearson did go one better five minutes later, tapping in after Davis had blocked efforts from Cole Skuse and Maynard.
Southampton had been unbeaten at St Mary's throughout 2011 going into this game, but it was a record that fell at the final hurdle.
Bristol City manager Derek McInnes:
"We have shown a lot of resolve and I am very pleased with each and every one of the players. They have all performed brilliantly tonight.
"We have now beaten the best side in the league twice this season and it amazes me how we can do that but struggle to get results elsewhere.
"We asked a lot of questions when we were beaten against Coventry in our last game but the players have bounced back and showed a lot of commitment and confidence to beat such a good side who I have such admiration for."
Southampton manager Nigel Adkins:
"It is a shame the amazing run has come to an end but we have to look onto the next game and hope we have another great run next year.
"I hope that we can get another string of results together at home and go unbeaten for the whole of 2012.
"It was a tough game for us as Bristol City defended very well and Derek has improved them immensely since he has come in as manager."
Live Text Commentary
Full Time The referee ends the match.90:00 +5:49
Indirect free kick taken by Daniel Fox.90:00 +5:49 Booking
Booking Booking for Nicky Maynard for time wasting.90:00 +5:44
David Clarkson is ruled offside.90:00 +5:08
Neil Kilkenny takes the direct free kick.90:00 +5:08 Booking
Booking Daniel Fox receives a caution.90:00 +4:56
Daniel Fox concedes a free kick for a foul on David Clarkson.90:00 +3:34 Booking
Booking David James receives a caution.90:00 +2:57
Centre by Steve De Ridder.90:00 +2:39
Marvin Elliott challenges Guly Do Prado unfairly and gives away a free kick. Guly Do Prado restarts play with the free kick.90:00 +1:28
Foul by Jos Hooiveld on David Clarkson, free kick awarded. Free kick taken by Louis Carey.89:03 Substitution
Substitution David Clarkson on for Albert Adomah.88:37
Guly Do Prado produces a left-footed shot from deep inside the penalty area which goes wide of the right-hand post.86:55
Direct free kick taken by Neil Kilkenny.86:55 Substitution
Substitution Lee Holmes on for Frazer Richardson.86:55
Marvin Elliott fouled by Guly Do Prado, the ref awards a free kick.86:16
Free kick awarded for an unfair challenge on Neil Kilkenny by Jack Cork. Direct free kick taken by Neil Kilkenny.85:32 Substitution
Substitution (Bristol City) makes a substitution, with Martyn Woolford coming on for Stephen Pearson.84:04
The ball is swung over by Steve De Ridder, Cole Skuse makes a clearance.82:15
Unfair challenge on Nicky Maynard by Dean Hammond results in a free kick. Lewin Nyatanga takes the free kick.
Corner taken left-footed by Daniel Fox to the near post, Marvin Elliott manages to make a clearance.80:18
James Wilson gives away a free kick for an unfair challenge on Richard Lambert. Richard Lambert takes the free kick.79:56 Substitution
Substitution Dean Hammond is brought on as a substitute for Morgan Schneiderlin.78:17
Assist by Nicky Maynard.78:17 Goal scored
Goal! - Stephen Pearson - Southamp'n 0 - 1 Bristol C Stephen Pearson gets on the score sheet with a goal from inside the box low into the middle of the goal. Southampton 0-1 Bristol City.78:14
Nicky Maynard takes a shot. Kelvin Davis makes a save.77:53
Cole Skuse takes a shot. Save made by David James.76:30 Substitution
Substitution Adam Lallana goes off and David Connolly comes on.75:45
Inswinging corner taken left-footed by Daniel Fox, Cole Skuse makes a clearance.75:10
Shot by Richard Lambert. Save by David James.74:07
Adam Lallana gives away a free kick for an unfair challenge on Cole Skuse. Free kick taken by Marvin Elliott.73:31
Steve De Ridder handles the ball and concedes a free kick. Direct free kick taken by Neil Kilkenny.73:03
Stephen Pearson takes a shot. Save by Kelvin Davis.71:54
Morgan Schneiderlin concedes a free kick for a foul on Marvin Elliott. Free kick taken by Neil Kilkenny.68:34
Daniel Fox crosses the ball in from the free kick, save by David James.68:34 Booking
Booking Stephen Pearson is booked.68:22
Stephen Pearson gives away a free kick for an unfair challenge on Steve De Ridder.65:47
Headed effort from inside the area by Marvin Elliott misses to the left of the target.64:32
James Wilson takes the direct free kick.64:32 Substitution
Substitution Kalifa Cisse leaves the field to be replaced by Neil Kilkenny.64:32 Booking
Booking Morgan Schneiderlin goes into the referee's book.64:22
Morgan Schneiderlin gives away a free kick for an unfair challenge on Albert Adomah.62:58
The ball is swung over by Steve De Ridder, Headed effort from inside the area by Guly Do Prado misses to the left of the target.62:28
Daniel Fox takes a outswinging corner from the left by-line played to the near post, clearance by Kalifa Cisse.61:29
Free kick awarded for an unfair challenge on David James by Morgan Schneiderlin. David James restarts play with the free kick.60:17
Daniel Fox takes the free kick.60:17 Booking
Booking James Wilson booked for unsporting behaviour.60:03
Foul by James Wilson on Morgan Schneiderlin, free kick awarded.59:14
Free kick awarded for a foul by Steve De Ridder on Ryan McGivern. Direct free kick taken by David James.58:48
Corner taken by Cole Skuse, Kelvin Davis makes a save.57:42
Shot from deep inside the area by Jack Cork clears the bar.57:04
Free kick awarded for a foul by Louis Carey on Guly Do Prado. Free kick taken by Daniel Fox.56:05
Daniel Fox challenges Albert Adomah unfairly and gives away a free kick. Free kick taken by Louis Carey.55:52
Steve De Ridder produces a cross, Lewin Nyatanga makes a clearance.54:09
Morgan Schneiderlin fouled by Cole Skuse, the ref awards a free kick. Daniel Fox restarts play with the free kick.53:31
Guly Do Prado produces a right-footed shot from just outside the area that goes harmlessly over the bar.53:16
Nicky Maynard is flagged offside by the assistant referee. Kelvin Davis takes the free kick.52:03
Frazer Richardson sends in a cross.49:20
Nicky Maynard is caught offside. Kelvin Davis takes the indirect free kick.48:25
The offside flag is raised against Guly Do Prado. Free kick taken by David James.47:01
Cole Skuse is ruled offside. Free kick taken by Kelvin Davis.46:21
Daniel Fox concedes a free kick for a foul on Albert Adomah. Louis Carey restarts play with the free kick.45:54
Frazer Richardson sends in a cross.45:01
The second half kicks off.45:00 +1:03 Half time
Half Time The first half comes to an end.45:00 +0:30
Corner taken by Daniel Fox from the left by-line played to the near post, clearance by Albert Adomah.45:00 +0:05
Richard Lambert takes a shot. Lewin Nyatanga gets a block in.43:39
Free kick awarded for a foul by Louis Carey on Richard Lambert. Direct free kick taken by Daniel Fox.39:51
Corner taken left-footed by Daniel Fox from the right by-line, Cole Skuse makes a clearance.36:50
A cross is delivered by Richard Lambert, Daniel Fox produces a volleyed left-footed shot from deep inside the penalty box which goes wide of the right-hand upright.35:41
The assistant referee signals for offside against Guly Do Prado. Free kick taken by Louis Carey.34:53
Nicky Maynard has an effort at goal from just inside the box that misses to the right of the goal.34:00 Booking
Booking Louis Carey receives a yellow card.33:15
Steve De Ridder takes a shot. Save made by David James.31:45
Corner taken by Cole Skuse, Aaron Martin manages to make a clearance.31:28
Albert Adomah takes a shot. Kelvin Davis makes a save.28:51
Richard Lambert gives away a free kick for an unfair challenge on Louis Carey. Direct free kick taken by David James.27:30
Inswinging corner taken by Daniel Fox, Close range header by Richard Lambert goes over the crossbar.26:53
Morgan Schneiderlin takes a shot. Save by David James.24:03
Effort on goal by Albert Adomah from just outside the area goes harmlessly over the target.21:31
Shot by Jack Cork from outside the box goes high over the target.20:01
Foul by Jack Cork on Nicky Maynard, free kick awarded. Kalifa Cisse restarts play with the free kick.16:48
The assistant referee flags for offside against Guly Do Prado. Free kick taken by Lewin Nyatanga.9:23
Free kick awarded for an unfair challenge on Nicky Maynard by Aaron Martin. Free kick taken by Ryan McGivern.8:47
Daniel Fox delivers the ball.8:07
Free kick awarded for an unfair challenge on Jack Cork by Marvin Elliott. Free kick taken by Jos Hooiveld.6:50
Stephen Pearson sends in a cross, save by Kelvin Davis.6:18
Nicky Maynard is ruled offside. Kelvin Davis takes the indirect free kick.4:30
Unfair challenge on Marvin Elliott by Morgan Schneiderlin results in a free kick. Free kick taken by Marvin Elliott.2:31
Ryan McGivern produces a cross, Kelvin Davis makes a save.1:43
Steve De Ridder gives away a free kick for an unfair challenge on Ryan McGivern. Ryan McGivern takes the free kick.0:56
Centre by Steve De Ridder, David James makes a save.0:00
The ref blows the whistle to start the match.
Live data and text provided by our data suppliers