The Hammers needed a victory at the DW Stadium to stand any chance of beating the drop and were 2-0 up at half-time courtesy of Demba Ba's headers on 12 and 26 minutes.
The Latics stormed back after the break. N'Zogbia scored twice, either side of a Conor Sammon goal, leaving Roberto Martinez's side in the bottom three on goal difference alone and sending the visitors down.
Down and out: N'Zogbia celebrates his late winner (above) which consigned West Ham to the Championship (below)
Wigan are 19th in the table with one game to go, level on 39 points with 18th-placed Blackpool and 17th-placed Birmingham, who lost against Fulham today.
Rock-bottom West Ham, meanwhile, must face up to the reality of life in the npower Championship.
Wigan broke forward early on and after receiving Mohamed Diame's pass, Tom Cleverley fired a deflected shot towards goal which Robert Green pushed behind.
Super strike: Charles N'Zogbia scores a stunning free-kick to get Wigan back into the game
Changing man: Conor Sammon celebrated his first goal for Wigan, a strike that give Roberto Martinez's men hope of staying in the Premier League and consigned West Ham to the Championship
Diame then turned in the box and blasted an effort over the bar before Hugo Rodallega swivelled on the edge of the area and brought another save out of Green.
West Ham had shown little going forward, but a minute later they took the lead after the Latics failed to deal with a corner.
In the ensuing scramble, Jack Collison's shot was blocked and the ball came out to Thomas Hitzlsperger, who crossed for Ba to head past Ali Al Habsi.
Enlarge Up and away: West Ham are taunted by their rivals as a plane above the DW Stadium tows a banner displaying a message: 'Avram Grant - Millwall Legend'
Sorry sight: Avram Grant faces an uncertain future after failing to keep West Ham in the Premier League in his first season in charge
The hosts tried to respond immediately, with N'Zogbia producing a strike that Green gathered comfortably.
A cross from Emmerson Boyce and free-kick from Ben Watson threatened the Hammers box, but James Tomkins and Danny Gabbidon got important headers in to avert the danger, while Diame saw an attempt from distance caught by Green.
Wigan seemed to have regained the momentum - yet within moments, they were 2-0 down.
Hammer time: A brace from Demba Ba offered West Ham a small glimmer of hope that they could still survive in the Barclays Premier League
Hitzlsperger was the creator once more, the German's delivery headed back across goal by Tomkins for Ba to nod in his second.
The home side almost fell even further behind just after the half-hour mark when Frederic Piquionne guided the ball beyond Al Habsi, only for Watson to clear off the line.
Wigan managed to compose themselves and went back on the attack, but they could not find a way past Green, who parried an overhead kick from Rodallega.
Head boy: Demba Ba nods the Hammers in front at the DW Stadium with Wigan keeper Al-Habsi unable to prevent the striker's header
He then denied Diame after the midfielder squeezed through, before blocking a point-blank header from Rodallega.
Cleverley nearly latched on to a high ball over the top in first-half stoppage time but was beaten by the bounce.
Martinez made two substitutions at the interval, bringing on Victor Moses and Sammon for James McCarthy and Cleverley.
Take it away: Ba doubles his tally for the afternoon with West Ham's second
Six minutes after the restart, Watsoncurled an effort narrowly wide. Ba then drove one across goal at the other end before Wigan pulled themselves back into the game.
Having been fouled by Tomkins, N'Zogbia stepped up to take the resulting free-kick himself and lashed it into the corner of the net, his fourth goal in five games.
West Ham boss Avram Grant reacted by introducing the inspirational figure of Scott Parker from the bench in place of Jonathan Spector.
Keeping up appearances: After failing to turn up to West Ham's last away game at Manchester City, the club's co-owners David Gold and David Sullivan were in attendance at Wigan - and paid for the fans travel too
Soon after Ba was through one-on-one against Al Habsi, but could only shoot into the Oman stopper's arms.
That proved costly for the Hammers asSammon then ran on to Watson's pass, turned inside Gabbidon and slottedhome his first Wigan goal to level the scores.
The equaliser set up a frantic finale, with both sides desperately seeking a winning goal.
Great Scott: Parker's career with the Hammers is in its final stages now relegation has been confirmed
Moses fired into the side-netting after being teed up by Sammon before Zavon Hines had two shots blocked in the area, first by Maynor Figueroa and then Gary Caldwell.
Gabbidon prevented Sammon from going clean through with a challenge that Latics fans felt was a foul, but referee Mike Dean waved play on.
Hitzlsperger sent a free-kick wide and N'Zogbia overhit a through-ball that could have released Sammon.
Lifeline: N'Zogbia's late strike gives Wigan hope of survival
When Watson saw his low shot came back off the post and then Green smother at his feet moments later, it seemed Wigan's chance for a precious victory was gone.
But N'Zogbia had the final say in the94th minute, cutting into the box and slipping a shot under Green to keep Wigan in the fight for survival.
Wigan v West Ham: How the action unfolded at the DW StadiumStruggling boss Grant insists Hammers are better than last year!The ?40m day of destiny: West Ham and Wigan face up to cost of relegationAll the latest Wigan news, features and opinionAll the latest West Ham news, features and opinion
Explore more:People: Roberto Martinez, Jack Collison, Robert Green, Gary Caldwell, Danny Gabbidon, Emmerson Boyce, James Tomkins, Ben Watson, James McCarthy, Thomas Hitzlsperger, Mike Dean Places: Birmingham, Oman