Leighton Baines scored a sensational first senior goal to put the visitors in front, but Richard Naylor's header set up an exciting finish, capped by Darren Bent's precise lob with a minute to go.
Wigan started the better with Jason Roberts causing Town's defence all sorts of problems. First he beat Naylor to a loose ball and squared for Gary Teale, only for Kelvin Davis to block at his feet, and then Roberts shrugged off Matt Richards but shot tamely at the keeper.
Jim Magilton shot over for the home side, who then had two shots from Fabian Wilnis and Tommy Miller blocked, before the loose ball fell to Ian Westlake, who fired a 20-yard volley over.
Darren Currie, on his home debut, curled in a 25-yard free-kick which John Filan dived to save, before Westlake had a shot deflected wide at one end, and then at the other former Ipswich loanee Alan Mahon's shot looped onto the roof of the net, via Miller's back.
Bent missed a great chance after sidestepping Ian Breckin, but curling a left-foot shot wide, before Mahon, Lee McCulloch and Teale all fired in off-target efforts.
In the final five minutes of the half, Shefki Kuqi had three great chances, but he blazed the first over, headed a Currie cross inches wide and then opted to pass when he should probably have gone himself.
Town started the second half strongly, with Filan diving to save from Bent, parrying a Currie effort which neither Bent nor Kuqi could collect, before Wilnis fired wide after a one-two with Kuqi.
Against the run of play, Wigan went ahead after 57 minutes when Baines unleashed a sensational 35-yarder into the top corner with his left foot, after a corner was cleared out to him.
It was a goal fit to win any game, but Ipswich were not in the mood to surrender their unbeaten home record and were level nine minutes later when Naylor flicked Currie's right-wing free-kick into the corner with Filan helpless.
Baines was denied from similar range by Davis a minute later and Roberts fired a loose ball wide as Wigan tried to hit back instantly.
Nathan Ellington fire a snap-shot wide and McCulloch's volley was straight at Davis as the visitors continued to press. But then at the other end a long ball bounced through to Kuqi, whose header was only just tipped away by Filan.
Bent volleyed well over before Davis dived to turn away a low Ellington shot after he clipped the ball neatly over Wilnis, before Davis parried away a low Bullard free-kick.
With the clock running down, Town won it with a minute to go when Miller's long ball was missed by both Kuqi and Breckin, but Bent beat Matt Jackson to the loose ball to loft it over the stranded Filan to send the hosts top of the league, at Portman Road!
Click here for Match Photos from the game.