Wigan won away for the first time since April by beating Birmingham 3-2 to heap pressure on Blues head coach Pep Clotet.
Striker Josh Windass, son of former Hull and Bradford striker Dean, scored the first goal for Wigan and had a hand in the other two as Blues' poor run stretched to one win in 12 games.
Kerim Mrabti equalised for Blues but Gary Gardner's own goal and a Cedric Kipre effort moved Wigan from the foot of the table up to third from bottom and to within a point of safety.
Substitute Jacques Maghoma pulled one back for Blues, but after one of their worst performances of the season they are now only six points above the drop zone after taking just one from the last 18 available.
In a tactical move that backfired, Clotet played Gardner as a makeshift centre-back, and the midfielder was partly at fault for Wigan's first two goals.
Clotet has won one game in seven since being confirmed as head coach and Blues face trips to fellow strugglers Luton and Middlesbrough in two of their next three Sky Bet Championship games.
After Blues striker Lukas Jutkiewicz planted a firm header over the bar from Jeremie Bela's corner, Wigan took the lead in the ninth minute following a mix-up between Gardner and Jude Bellingham, who slid into his team-mate and took the ball off him.
From the loose ball, Joe Williams crossed from the left and Windass tapped home at the far post.
Windass's third goal of the season – and 50th of his career in all competitions – ended Wigan's 254-minute wait for an away goal.
Blues had to thank goalkeeper Connal Trueman for keeping them in the game with four saves in quick succession.
First, he smothered Williams's drive from outside the box. On the half-hour mark, he dived bravely at the feet of Jamal Lowe after a miscommunication between Trueman and Kristian Pedersen, then blocked the follow-up from Williams.
Trueman foiled Wigan again from Windass' resulting corner, diving low to his right to push Kipre's header around the post.
The home side levelled against the run of play in the 39th minute.
Mrabti turned neatly in the box from Pedersen's pass and beat Kipre before firing home left-footed from a tight angle for his first goal at St Andrew's.
Wigan regained the lead in the 50th minute. Lee Evans split the defence and Windass beat the offside trap and rounded Trueman before firing across goal, with the ball going in off Gardner's thigh for an own goal.
The visitors made it 3-1 in the 73rd minute when Jutkiewicz's header from Windass's corner hit Kipre on the chest and went in.
Maghoma forced home when he got to Jutkiewicz's knockdown from Bellingham's cross 10 minutes from time.
Wigan were indebted to goalkeeper Jamie Jones for parrying substitute Alvaro Gimenez's header as they held on for a vital win.
No Data Analysis info