York City Knights moved out of the bottom two of the Championship after a last-minute try sealed a 30-28 win over relegation rivals Dewsbury.
Chris Thorman kicked a touchline conversion after a Dave Sutton try for the Knights levelled the scores.
The result leaves them fourth from bottom of the table.
Coach Dave Woods told BBC Radio York: "Congratulations to the boys because the way they fought right to the end was great and they deserved the win."
However Woods admitted it had been a frustrating performance at times, after he saw his side let a 14-point first-half lead slip to turn round just 18-16 in front.
"I really congratulated them for going right to the death because we've said to them games are won right up to the whistle.
"We did that, and we played right up to the end today but we made it so hard for ourselves. We shouldn't have gone in with that small lead at half-time. We should have gone in well in control.
"Even though we're both going towards the bottom we're in a little bit better position than [Dewsbury] are I think.
"We've been playing some pretty decent football and they've been stuggling a little bit. They came out today and had everything to play for and were really enthusiastic.
"We weren't the same as we had been over the last few weeks but we still did a lot of good things as well. But like I said, [my players] deserve congratulations for battling right to the end."