Striker Madine gave Wednesday a fifth-minute lead in Saturday's League One clash at Hillsborough, bundling the ball home from close range after meeting Lewis Buxton's low cross.
Controversy followed moments later when referee James Linington reversed his initial decision to award Scunthorpe a penalty - following David Prutton's challenge on Chris Dagnall - after consulting one of his assistants.
Marshall put Wednesday further ahead in the 17th minute with an angled effort which was deflected into the roof of the net.
The lively Dagnall struck a post before Bobby Grant pulled a goal back for Scunthorpe in the 67th minute, tucking the ball neatly past Nicky Weaver from inside the area.
Three minutes later, Madine grabbed his second goal of the game, slotting the ball past the advancing Lillis after being put through on goal before substitute Mark Duffy scored five minutes from time to set up a tense finish, but Wednesday held on to win.