The home side produced a superb defensive effort to hand the Dragons their first loss of the season.
The win had seemed safe with 14 minutes to go when hooker Isaac Luke grabbed the home side's third try.
Luke, who made several dummy-half runs, produced a 40-20 and finished off by scoring close to the line.
But the Dragons set up a grandstand finish when second-rower Tariq Sims forced his way over for a converted try with six minutes to go to close the gap to four points.
The Warriors came up with the match-winner, Isaiah Papali'i scoring as the clock ticked down.
The Warriors, looking to rebound from their first loss of the year, were without halfback Shaun Johnson and centre Solomone Kata, both late withdrawals with injury.
They also lost Tohu Harris after 26 minutes, the second-rower collecting a second knock to the head, and they had to overcome the sin-binning of five- eighth Blake Green.
Johnson and Kata's replacements, Mason Lino and Anthony Gelling, stepped up with first-half tries to give the home side a 10-0 halftime lead.
Lino took just three minutes to make his mark, jinxing his way over.
The Warriors had to come up with plenty in defence and weren't helped by a hefty penalty count against them.
They kept a keen eye on fleet-footed fullback Matt Dufty, who couldn't create damage with his cross-field runs.
When they worked their way upfield for a rare attack, Gelling stepped his way over for his first NRL try, with Lino adding the extras.
The four-pointer had been set up by Green, who forced a repeat set with a kick into the in-goal and produced the pass to send Gelling over.
But with a minute to go until halftime, and with the Warriors having been warned about penalties conceded, Green was sent to the bin for a professional foul.
With just seconds to go before he was due back, the Dragons finally broke through, halfback Ben Hunt producing a piece of magic as he stepped over next to the posts.
The Dragons, with Hunt impressive in the second half, continued to ask questions and the Warriors were given a huge let-off with 17 minutes to go.
The visitors appeared set to hit the front after centre Tim Lafai intercepted a loose pass from winger Ken Maumalo, but the try was disallowed for an earlier knock-on.
The results moves the Warriors into second place on the NRL table with the Dragons still at the top on points difference.
The next match for the Warriors is against the Melbourne Storm on ANZAC day.