Adam Swift and Ryan Morgan went over, and Tommy Makinson kicked a penalty to put Saints 14-0 up early on.
Benjamin Jullien and Mike Cooper crossed for the hosts before half-time, and Harvey Livett's try put them in front after the break.
The Wire dominated from then on, with Ryan Atkins adding two tries, and Tom Lineham and Rhys Evans both going over.
Dominique Peyroux also scored a late consolation in a difficult second-half for the visitors.
Defeat for Saints comes a day after Sydney Roosters assistant Justin Holbrook was named as their new head coach, but the 41-year-old Australian is yet to take charge as he awaits a visa.
Victory for Warrington was their fifth in sixth games, having lost to Hull FC in their last match, and took Tony Smith's resurgent side up to ninth in the table and level on points with seventh-placed St Helens.
An encouraging night for the hosts was capped by Atkins' two late tries, which took him to 200 for his career.
Warrington head coach Tony Smith:
"It was probably our best performance in the league. After a costly start, we showed a lot of spirit to work our way back in and control it the way we did.
"We ended up with one of our least mistake-riddled games of the season and that gave us an opportunity to defend well.
"Harvey was very good. He came up with a couple of errors but got stronger as the game went on."
St Helens interim coach Sean Long:
"I thought we started the game with real intent and our completion was up to about 80 per cent in the first 20 minutes.
"But we let them back in the game and went away from the game plan.
"They wanted it a little bit more than us at times, which is disappointing."
Warrington: Gidley; Russell, Evans, Atkins, Lineham; Patton, Livett; Cooper, Dwyer, Sims, Jullien, Hughes, Westwood.
Replacements: King, Crosby, Philbin, Smith.
St Helens: Makinson; Swift, Spedding, Morgan, Grace; Fages, Smith; Amor, Lee, Douglas, Taia, Wilkin, Thompson.
Replacements: Roby, McCarthy-Scarsbrook, Walker, Knowles.
Warrington came from behind to beat St Helens in convincing fashion at the Halliwell Jones Stadium.