Zimbabwean striker Benjani Mwaruwari finally ended his goal famine to grab the Pompey equaliser and then played his part in the penalty spot winner from Matthew Taylor which sealed Premiership survival for Harry Redknapp's team.
Benjani, a Wigan target before his record £4million move to Portsmouth, cancelled out Henri Camara's first-half strike when he headed in his first goal in 15 appearances.
He was then denied the chance of a second by Gary Teale who handled the goalbound header, and was sent off by ref Mike Riley before Taylor kept his nerve to hammer in the spot kick.
But Wigan scorer Camara was left to reflect on a controversial offside decision which cost him a second goal in the first half.
Portsmouth started the day outside the drop zone, two points clear of Birmingham, who were involved in a must-win game of their own against Newcastle.
They had the backing of 5,200 Pompey fans who were packed into the North Stand and counting on their side to continue an impressive run towards Premiership survival.
Lomana LuaLua, a victim of his own goal celebration when he damaged an ankle, was still absent despite oxygen treatment to speed up his recovery. Back on duty was Pedro Mendes and Gary O'Neil was also included despite a niggling foot injury.
For Wigan it was party time, the last home game of the season and the chance to celebrate a remarkable first year in the Premiership.
There was though a tinge of regret among the Latics fans with crowd pleaser Jimmy Bullard not included in the side after his shock decision to join Fulham in a £2.5million deal.
David Thompson was drafted in to fill the gap and with John Filan and Gary Walsh injured, Wigan had no back-up keeper on the bench.
Dean Kiely got his first touch inside the opening 30 seconds holding onto a shot from Camara. And the keeper held his breath when ex-Blackburn star Thompson headed just over from Teale's cross.
Wigan survived a moment of danger when Svetoslav Todorov got his head to a cross fired accurately in from the right but the ball flew over the bar.
Leighton Baines was on the spot to clear a dangerous ball from Taylor but, from the corner, Mike Pollitt enjoyed a touch of good fortune when Benjani's shot came off his legs.
The Latics should have taken the lead when Camara raced clear but failed to come up with a finish to beat Kiely.
There was controversy in the 15th minute when Camara latched onto a superbly weighted pass from Thompson and went past the keeper before slotting the ball into the empty net.
But it was ruled out after a late offside flag from the referee's assistant, and the replay suggested the Wigan striker was unlucky to have the decision go against him.
It clearly fired the Senegal star up, and he suffered again when he had two more goal attempts kept out by the keeper.
Pompey went close on the half-hour when Sean Davis had a header cleared off the line by Baines with Pollitt beaten.
But Camara's luck finally changed as Wigan hit the front. Thompson banged in the cross after his corner was half-cleared, and Matt Jackson's header came back off Kiely, and Camara was on the spot to score the simplest of goals - his 12th in the Premiership.
The Wigan livewire almost struck again but failed to steer a header on target from six yards before the woodwork denied Pompey an equaliser. O'Neil tried his luck from long range and the dipping shot scraped the crossbar.
Wigan missed a chance when Jackson headed wide from a Thompson corner but, three minutes into the second half, Todorov should have levelled but somehow fired over from inside the six-yard box.
Portsmouth were foiled again when Pollitt saved from O'Neil but the equaliser finally arrived after 63 minutes when Benjani headed home after O'Neil's shot came back off the post.
Pollitt saved Wigan's bacon keeping one out from Mendes and Andres D'Alessandro fired just over the bar as Portsmouth went hunting a winner.
Their persistence paid off when Taylor scored from the spot - his sixth goal of the season - after Scottish star Teale had handled Benjani's header.
Portsmouth - who complete their fixtures with a home game against Liverpool - finished strongly but excellent saves by Pollitt from O'Neil and Benjani prevented further damage.