Jamie Paterson looked to have given the struggling Saddlers a precious victory at Hillsborough, but Madine netted at the death after Ryan Lowe had cancelled out Jon Macken's opener.
Michail Antonio almost gave the Owls a 17th-minute lead but his 25-yard strike clipped the top of David Grof's crossbar and flew over. Antonio again rattled the Walsall woodwork 10 minutes later, this time a powerful shot from the right-hand side of the 18-yard box cannoned back off the right post.
Macken put the visitors ahead 13 minutes into the second half, side-footing past Stephen Bywater after Florent Cuvelier had out-paced Lewis Buxton down the right.
But the lead was short-lived and Lowe equalised two minutes later, squeezing home his third goal in four games at the far post after Walsall had failed to clear Chris Lines' corner.
Paterson then lashed the ball across Bywater to restore the Saddlers' lead in the 73rd minute but Madine finished at the second attempt to deny Dean Smith's side all three points and plunge them into the League One relegation zone.