After a fairly drab first half, in which Ipswich old-boy Marcus Stewart's missed penalty was the main moment of note, a pulsating second period saw four goals and countless other close calls.
Richard Naylor was credited with Town's opener, before Sunderland hit back with goals from sub Stephen Elliott and Carl Robinson, only for Bent to strike with a minute left.
Sunderland had the better of the opening period, although neither side created a great number of openings before the visitors were awarded a controversial 24th minute penalty.
The ball appeared to strike the arm of Fabian Wilnis accidentally, but Premiership official Steve Bennett gave the spot-kick, only for former Blues hero Stewart to drag his left-footed kick wide of the right-hand post.
That was a let-off for Town, who finally forced rookie keeper Michael Ingham into a save on the half hour, although it was an easy one from a Darren Currie drive.
Ipswich had a good spell leading up to half-time, in which David Unsworth curled a 25-yard free-kick narrowly over and then Shefki Kuqi's turn and shot was gobbled up by Ingham.
Sunderland came close on 65 minutes when Liam Lawrence's free-kick was headed against the bar by Gary Caldwell, but a minute later Town went ahead.
Ingham dropped Currie's corner, Naylor prodded goalwards only for Robinson to scramble it away, but Jason De Vos followed up to make sure, although Naylor's initial effort may well have been over the line.
Sunderland immediately replaced Stewart and Chris Brown with fellow forwards Elliott and Brian Deane and they combined on 71 minutes for the equaliser, Deane heading back a Stephen Wright cross for Elliott to bundle in from a yard.
A De Vos mistake gave Dean Whitehead a clear run through, but his low shot was palmed round the post by Davis, although referee Bennett, who had a poor game, gave a goal-kick.
Sunderland went ahead on 84 minutes, Julio Arca crossing low from the left, Deane missed an open goal, but Robinson pounced to force the ball in from inside the six-yard box.
Town levelled with a minute left when Kuqi's flick found sub Pablo Counago and he laid a perfect pass off for Bent to fire low past Ingham's left hand.
There was still time for a winner, with five minutes added on, and Town could have nicked it when Ingham miscued a punch, but recovered to block Ian Westlake's shot, only for it to spin to Kuqi whose shot hit Caldwell.