Jordan Turner crossed the line for St Helens after 12 minutes, but the video referee revealed an obstruction in the build-up and the scores remained deadlocked.
Wigan opened the scoring four minutes later when Joel Tomkins crossed the line, and the Warriors continued to put pressure on the St Helens defence throughout the first half.
The Saints were level before half time though when Luke Walsh crossed the line and the try was awarded after consultation with the video referee.
The lead was extended eight minutes later when George Williams shimmied past the St Helens defence to cross under the posts.
© Getty Images
Adam Smith took St Helens within two points of their opponents in the 56th minute when he dodged two Wigan tackles before touching down.
With two minutes remaining, Wigan had another try disallowed when Anthony Gelling was held up above the line.
St Helens stole the victory in the final minute when Josh Jones outjumped Matt Bowen to touch down.
The result denies Wigan Warriors a place at the top of the Super League table.