High-flying Hull were hunting for a sixth successive win and the game could have gone either way in terrible rain at Headingley.
Lilley’s skilful pick-up from his own kick under pressure with 19 minutes to play, and the resulting conversion, nudged Leeds in front at 14-12 and it was a lead they wouldn’t relinquish.
As the hooter sounded, Jordan Thompson hacked on a loose ball, only for Ash Handley to deny the Airlie Birds by booting the ball dead.
With Huddersfield winning against Warrington, a defeat would have seen Leeds fall to the bottom of the table.
They didn’t know that in the grind of a first half, in which the Rhinos took 17 minutes to break the deadlock when Jimmy Keinhorst slid over in the left corner.
Chris Green burst through the middle and managed to reach over under pressure from Mitch Achurch to enable the scores to be levelled shortly after the half hour mark, but a Lilley penalty had the Rhinos 8-6 to the good at half time.
Within three minutes of the restart, Hull had the lead as veteran Kirk Yeaman crossed the whitewash, converted by Sneyd for 12-8.
It went end to end until Lilley, with blood gushing from his nose, trapped a poor pass from dummy half with his foot, picked up and kicked towards the line. It came back off Danny Houghton, he trapped with his foot again and then stretched over the line under pressure from two defenders.
It was just the tonic for the noisy and drenched support, and when Jones-Buchanan went over it looked like being Leeds’ night.
Stern Hull had other ideas though and Sneyd set up a dramatic final few minutes with a converted try four minutes from time, but the Rhinos held on.