Andy Williams scored a 95th-minute penalty to give Walsall a fourth-round tie againstLeicester City.
Two minutes from the end of normal time, the hosts looked to have earned a replay.
Madden gave a penalty kick for a foul on Liam Kinsella, allowing Williams to score.
Danny Johnson's shot went through Ben Hinchliffe's gloves as he scored.
The forward's effort provided relief for his side, who had been denied a goal when Liam Gordon rolled the ball past Hinchliffe after the break.
Several saves were made by Hinchliffe and Owen Evans.
Hinchliffe turned Hutchinson's drive around a post, denying Douglas James-Taylor's stab attempt from close range.
Antoni Sarcevic's shot was blocked before the break, and the debutant went close with a headed ball.
The League Two side were convinced that they should have been awarded a penalty when Tom Knowles tangled with Hussey in the home penalty area at the half-time break.
During the second half, Evans made a great reaction stop to prevent Kyle from scoring his third goal of the game.
Hinchliffe stopped a Williams headed ball in a frantic finish before the pressure paid off.
The manager of Stockport spoke to the radio.
Would we have gotten a replay? They would have been upset if they'd not won.
We were of the mindset that we could go on and win the game, not throwing it away. It's a huge missed chance.
It's even more disappointing that we didn't put in a performance that was good enough to get us into the fourth round and advance.
The manager of Walsall told the radio station.
The game was great. They are a good team. The draw for the players, the supporters, and everybody connected with the club made me very happy. There is a good day.
Andy is calm and collected. He's been there and done it. His contract has been doubled because of that goal.
I told our supporters at the half that we were going to score some goals. It was one hell of a strike by Danny Johnson. He couldn't have hit it any better after catching it.
It could give us more money to get things done. The chairman will not thank me for that, but he knows I mean it.