Jon Stead's last-gasp winner earned Sean O'Driscoll a 2-1 victory in his first home game in charge of Bristol City.
The former Ipswich player won the match with 60 seconds remaining to give the side rock-bottom of the Championship a huge three points in their battle against relegation.
The visitors led at half-time thanks to the recalled Daryl Murphy but just two minutes after the break substitute Steven Davies levelled with a fine finish.
Bristol City came into this match without a goal since New Year's Day, but their chances of ending that barren spell were boosted by the return of top scorer Sam Baldock to the starting line-up alongside Ryan Taylor.
While Baldock had been passed fit after injury Taylor had to be withdrawn after just 15 minutes with an arm problem and was replaced by Davies.
That early change of strike partner did not seem to phase Baldock who had the first real chance of a quiet opening to the match with an 21st minute volley from inside the box that was deflected just inches wide of Scott Loach's goal by Tommy Smith.
At the other end the visitors had their first chance of the match three minutes later, David McGoldrick controlling the ball on his chest before firing wide.
And the former Nottingham Forest man played a part in the game's opening goal on the half-hour mark. McGoldrick flicked the ball to the recalled Murphy who drew Tom Heaton in before coolly firing home his sixth of the season.
City, who have conceded more goals on home soil than any other team in the division, then came very close to letting in the 35th of the campaign eight minutes before the break when Lee Martin somehow missed the target from six yards after being found by McGoldrick's cross.
Just two minutes after O'Driscoll's first half-time team talk at Ashton Gate they did just that. Louis Carey's raking ball found Paul Anderson and the former Liverpool winger's reverse pass found Davies who finished from a tight angle to draw the home side level.
Ipswich were stung into action by that 47th minute equaliser and Murphy could have scored his second of the afternoon three minutes later but he nodded over the bar from inside the six-yard box.
Anderson thought he should have had a penalty with 12 minutes to go when he felt Bradley Orr handled the ball inside the box but his protests were waved away.
And just when it looked like the sides would have to settle for a point, debutant Brendan Moloney stood up a cross which Davies knocked down into the path of Stead and the striker kept his cool to earn a vital win.