Blues midfielder Alan McCormack headed into the top corner from Matt Paterson's cross in the 89th minute at Roots Hall.
Harry Crawford had earlier grabbed a goal on his full debut to equalise for the Shrimpers when he got a touch to Danny Swailes' headed clearance following good play from Johnny Herd after 75 minutes. That cancelled out Jabo Ibehre's opener for Stockport.
Ibehre, who spent a month on loan at Southend earlier in the season, had put the Hatters in front in the 71st minute when he headed past Steve Mildenhall from Danny Pilkington's free-kick.
Blues had an early McCormack goal ruled out for offside before the midfielder and Stuart O'Keefe had efforts just off target.
Stockport struggled to create clear-cut chances and had to wait until first-half stoppage time for James Vincent to have their first shot on target, a low effort which Mildenhall comfortably dealt with.