Flint prodded in after Wigan failed to clear a corner to lift the Robins above Blackburn on goal difference.
David Perkins went closest for Wigan in the first half when his curling shot from the angle of the box hit the bar.
Fit-again Bristol City striker Tammy Abraham was denied by home keeper Matt Gilks, while Flint also headed wide.
The result, coupled with Blackburn's 2-2 draw at Norwich, leaves City fourth from bottom, while Wigan are now four points adrift of safety with nine games left to play.
In a typically tense bottom-of-the-table encounter, chances were at a premium as Wigan responded to City's stronger start by hitting the bar through Perkins before Omar Bogle forced a fine save from Frank Fielding.
The visiting keeper also tipped a Gabriel Obertan header around the post before Gilks smothered Abraham's effort, on his return from a thigh injury, at the other end.
Bogle had a snap shot saved by Fielding after the break and Josh Brownhill fired inches wide for City.
But Flint finally ended City's run of seven games without a win three minutes from the end when he bundled home from a yard after Abraham had been unable to convert from close range.
Wigan boss Warren Joyce: "It's a cruel way to lose a game. We've looked at the build-up, it's not a corner, and he's in an offside position anyway.
"Having said that, I don't think we played well enough today - although we didn't deserve to lose the game.
"We didn't play with enough quality or enough drive. We didn't win as many individual battles as you'd like to win, and we gave away too many cheap free-kicks, which slows the play down and takes the pressure off them."
Bristol City boss Lee Johnson: "We needed that - the run we've been on hasn't been great, to say the least. I'm just delighted to get the win as we had that bit of luck.
"It probably wasn't a corner [for the Flint goal] but we got it and, over the course of the 90 minutes, we were the better side. We had chances in the first half. It's a massive win and the players are buzzing - it's like a nightclub in that dressing room!
"We've need that winning feeling back, especially today, which had a cup final feeling about it. We've only got nine games left and we needed to win it."
Match ends, Wigan Athletic 0, Bristol City 1.
Second Half ends, Wigan Athletic 0, Bristol City 1.
Foul by Mikael Mandron (Wigan Athletic).
Joe Bryan (Bristol City) wins a free kick in the defensive half.
Foul by Michael Jacobs (Wigan Athletic).
Lee Tomlin (Bristol City) wins a free kick on the left wing.
Corner,  Bristol City. Conceded by Jamie Hanson.
Foul by Omar Bogle (Wigan Athletic).
Bailey Wright (Bristol City) wins a free kick in the defensive half.
Omar Bogle (Wigan Athletic) wins a free kick in the attacking half.
Foul by Gary O'Neil (Bristol City).
Goal!  Wigan Athletic 0, Bristol City 1. Aden Flint (Bristol City) right footed shot from the centre of the box to the centre of the goal. Assisted by Tammy Abraham following a corner.
Attempt blocked. Tammy Abraham (Bristol City) right footed shot from the centre of the box is blocked. Assisted by Aden Flint.
Corner,  Bristol City. Conceded by Dan Burn.
Corner,  Bristol City. Conceded by Dan Burn.
Attempt blocked. Lee Tomlin (Bristol City) right footed shot from outside the box is blocked.
Substitution, Wigan Athletic. Shaun MacDonald replaces Stephen Warnock because of an injury.
Lee Tomlin (Bristol City) wins a free kick in the attacking half.
Foul by Jamie Hanson (Wigan Athletic).
Corner,  Bristol City. Conceded by Jake Buxton.
Attempt missed. Josh Brownhill (Bristol City) left footed shot from the centre of the box is close, but misses to the right.
Korey Smith (Bristol City) wins a free kick in the defensive half.
Foul by Mikael Mandron (Wigan Athletic).
Delay over. They are ready to continue.
Delay in match  (Bristol City).
Substitution, Wigan Athletic. Mikael Mandron replaces Alex Gilbey.
Foul by Aden Flint (Bristol City).
Omar Bogle (Wigan Athletic) wins a free kick on the left wing.
Substitution, Bristol City. Josh Brownhill replaces David Cotterill.
Substitution, Bristol City. Callum O'Dowda replaces Marlon Pack.
Attempt missed. Aaron Wilbraham (Bristol City) header from the centre of the box is high and wide to the left. Assisted by David Cotterill with a cross.
Substitution, Wigan Athletic. James Weir replaces Gabriel Obertan.
Attempt saved. Omar Bogle (Wigan Athletic) header from the right side of the six yard box is saved in the bottom right corner. Assisted by Michael Jacobs with a cross.
Corner,  Wigan Athletic. Conceded by Aaron Wilbraham.
Corner,  Wigan Athletic. Conceded by Gary O'Neil.
Corner,  Wigan Athletic. Conceded by Korey Smith.
Corner,  Bristol City. Conceded by Callum Connolly.
Attempt saved. Omar Bogle (Wigan Athletic) left footed shot from the left side of the six yard box is saved in the top right corner. Assisted by Michael Jacobs.
Substitution, Bristol City. Aaron Wilbraham replaces Matty Taylor.
Foul by Jamie Hanson (Wigan Athletic).
Aden Flint scored a late winner as Bristol City climbed out of the Championship relegation zone with victory at fellow strugglers Wigan.