Scott Drinkwater had two tries assists and Valentine Holmes produced his best game so far this season as North Queensland snapped a three game NRL losing streak with an 18-16 win over Newcastle.
Trailing 16-12 after Newcastle scored two second-half tries through Dominic Young and Lachlan Fitzgibbon when Murray Taulagi was sin-binned for a late shot on Dane Gagai, Holmes stepped up to put the hosts ahead before a frantic finish.
The Queensland and Australia representative shaped left and beat two defenders before passing inside to Tom Dearden in the 64th minute, with his contentious pass cleared by referee Ben Cummins and a sideline official.
Holmes converted and the Cowboys led by two points before the Knights threw absolutely everything at them in a pulsating ending at Queensland Country Bank Stadium
With the clock inside two minutes, Newcastle found themselves deep inside the Cowboys half but some desperate and last-ditch goal-line defence thwarted the chance at a first win in Townsville since 2015.
Coach Todd Payten was relieved his side held on in the dying stages after 40 missed tackles.
"It wasn't always pretty but the effort, sacrifice is still there and we got away with a much-needed win," he said.
Holmes and fellow Queensland centre Gagai for Newcastle were the standouts in an error-strewn match that saw the Cowboy finishing with 209-run metres, three tackle breaks and a try assist.
Gagai was immense for the Knights and led the game with 221-run metres and 12 tackle breaks.
Newcastle coach Adam O'Brien rued another week of ill discipline costing his side at crucial moments.
"There's way too many errors in our game at the moment," O'Brien said.
"It's good getting pats on the back for effort ... but it can't be enough. We've got to want more, we've got to execute a lot better."
Newcastle's 14 errors led to just 67 percent completion for the match and allowed the Cowboys plenty of opportunities in a must-win game with their season hanging in the balance.
And they relied on Drinkwater to fire them out the blocks, assisting in two opening-half tries.
Reece Robson, who leads the NRL in runs from dummy-half, darted out from the ruck in the ninth minute and found his fullback, who dummied through the line before passing inside to Robson for the opener.
Dearden dropped the ensuing restart kick and Newcastle pounced through Greg Marzhew following a through-the-hands play to their left edge.
The match settled briefly as Jackson Hastings' and Chad Townsend's kicking games kept both sides pinned inside their own halves.
It took a fortuitous six again for the Cowboys to break the 6-6 deadlock deep in Knights territory, and it was Drinkwater again on the fifth tackle who shifted right to Kyle Feldt for a one-handed diving put-down.
Newcastle's eight first-half errors allowed a free flowing and relaxed Cowboys attack threaten both edges.
But the Knights remained resolute in the final 15 minutes before the main break, coinciding with Kalyn Ponga's introduction to the game.
Playing his 100th NRL game, Ponga made a solid contribution from the bench in a much-anticipated return after missing five games due to concussion.