Colchester had looked on course for a first win at Portman Road in 56 years when they led 1-0 through Clive Platt's 25-yard volley and were then awarded a controversial 70th minute penalty.
Town keeper Neil Alexander was ruled to have tripped Kevin Lisbie, but he made amends by keeping out Mark Yeates' penalty.
Two minutes later, Town levelled through Jon Walters, and went on to claim the points with late goals from subs Liam Trotter - his first senior goal - and a first of the season for Danny Haynes.
In a surprisingly tame first half, it was fully 22 minutes before either keeper was tested, with Aidan Davison dealing with Pablo Counago's 20-yard curler fairly comfortably.
Alexander palmed over a back-header by Platt from a George Elokobi long throw, before Alan Lee blocked Danny Granville's header from the ensuing corner, with Colchester claiming he'd used a hand, but ref Keith Stroud was unmoved.
On 31 minutes the visitors went ahead with a superb goal. Johnnie Jackson chested down Elokobi's left-wing cross and Platt fired a fierce shot beyond the helpless Alexander.
Davison saved from Lee as Town tried to rally and then Pat Baldwin hooked a dangerous Dan Harding cross over his own bar with Lee waiting to pounce and then Alexander saved a Granville header from a Yeates corner.
Colchester should have made it 2-0 on 38 minutes when Platt broke clear and lobbed the advancing Alexander, but, with Jason De Vos rushing back, Platt dragged his shot woefully wide.
Both sides created chances in the second half, without really carving each other open, with probably the best opportunity being Matt Connolly's far post header from a Jackson corner which was well saved by Alexander.
Counago volleyed wide for Town from a good position before the key moment in the match, with Yeates seeing his spot-kick saved by Alexander diving to his right.
Town were level on 72 minutes when Counago pulled the ball back to Harding whose fierce low cross was controlled by Walters and volleyed home from eight yards.
Sub Haynes made a fine block to deny Platt from a quick Colchester break before Town went ahead on 81 minutes when another replacement, Trotter, was left completely unmarked to head past Davison from six yards.
Town then clinched the points with six minutes to go when a deep ball from Fabian Wilnis was allowed to bounce by the Colchester defence and Haynes nipped in to nod over an exposed Davison.
The final scoreline was probably a little harsh on Colchester, but Ipswich won't care as the result lifts them back into the play-off places.