The Hammers needed a victory 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.
However their defensive deficiencies were once again exposed after the break as Charles N’Zogbia scored twice, either side of a Conor Sammon goal, the second coming in stoppage time.
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. Latics are on minus 22, with Blackpool on minus 21 and Birmingham on minus 20.
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.
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 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.
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.
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.
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.
Six minutes after the restart, Watson curled 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.
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 as Sammon then ran on to Watson’s pass, turned inside Gabbidon and slotted home his first Wigan goal to level the scores.
The equaliser set up a frantic finale, with both sides desperately seeking a winning goal.
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.
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 the 94th minute, cutting into the box and slipping a shot under Green, who was badly at fault, to keep Wigan in the fight for survival.