Former Sheffield United defender David Unsworth sent the Blades back to the Championship and ensured Wigan will start next season in the top-flight.
West Ham's shock 1-0 win at Manchester United opened the trap door for Neil Warnock's side, who at one stage had been ten points clear of the drop zone.
Wigan had taken a shock lead before Jon Stead headed equaliser and the stage was then set for 33-year-old Unsworth to score from the penalty spot before Paul Jewell's side were reduced to ten men to set up a nail-biting finish.
Emile Heskey had caused problems in the opening minutes twice winning aerial duels with Matthew Kilgallon as nervy United were forced back.
The former Liverpool striker almost connected with cross from Antonio Valencia before Wigan snatched the lead on 14 minutes.
Heskey sparked the move spraying the ball to Kevin Kilbane on the right flank and his low cross was met by Paul Scharner, who conjured up a stunning goal by slamming a low left-foot shot into the corner from 16 yards
The Austrian midfielder should have snatched a second nine minutes later with Heskey again involved as he crossed towards the far post as the unmarked Scharner headed over from eight yards.
United pulled level in the 38th minute with a Stead goal that left three players injured.
Phil Jagielka floated a low cross towards the near post as Stead, keeper Mike Pollitt and full-back Ryan Taylor all went for the ball.
Stead got the first touch heading in from six yards but took a punch from Pollitt as the keeper tried to clear with Taylor also injured.
The United striker and Pollitt resumed normal play after treatment with the limping Taylor replaced by Unsworth.
The big defender struck four minutes into injury time after Wigan won a free-kick on the right.
Kilbane's cross caused havoc in the United defence as Jagielka deftly handled at the near post and Unsworth stepped forward to coolly slot the ball beyond Paddy Kenny's reach from the spot.
Kenny produced a stunning save to keep United in the game in the 51st minute.
Denny Landzaat's corner from the left was headed back into the goalmouth by substitute Josip Skoko and Heskey produced an eye-catching overhead kick from ten yards which pushed away in spectacular fashion by the United keeper.
United should have been back on level terms three minutes later as Danny Webber beat the offside trap to race through as Pollitt charged off his line, but the former Watford striker watched in agony as his shot cannoned off the post.
Wigan were down to ten men in the 74th minute after Lee McCulloch was red carded for upending Michael Tonge after picking up a 55th minute booking.
Keith Gillespie saw his corner bounce off the crossbar as United threw everything at the Wigan goal, but in the end the Blades couldn't find an equaliser which would have prevented an immediate return to the Championship.