Northern Ireland’s Mark Allen produced a sensational recovery as he fought back from 6-1 down to beat Ding Junhui 10-7 and win his first UK Championship.
Ding, 35, looked in complete control with three centuries in the opening seven frames on his way to what would have been a fourth UK success.
But Allen took the last frame of the afternoon session and the first six in the evening as the match swung around.
Ding made 105 in the 15th frame, but Allen clinched a sensational success.
The match, which did not finish until 23:30 GMT, will be regarded as one of the most enthralling UK Championship finals in the 45-year history of the tournament.
“It’s absolutely amazing and I don’t really know how I have won that,” said Allen. “I’ve not played well most of the week, I didn’t play well in the first session and got punished.
“I hung in and secured the last frame and my first break of 60 [in the second session] I felt so good and started to score.
“At 6-6 I felt so confident. To beat Ding in the best of 19 frames match when being 6-1 down is one of my best-ever wins – he’s an absolute legend.
“I was struggling and I was just trying to stay as positive as possible. All I said was ‘can I win the next frame?’ and ultimately the answer is ‘yes’.
“I’m trying to leave my own legacy but I’m a long way from that at the moment. I’ve won two of the last three ranking tournaments and been in the final of the other one so I’m doing things right and that’s work hard so I will not change that.”
Allen, 36, had been declared bankrupt in May 2021 and previously said he was ‘spending the money as quickly as he earned it’, but this victory sees him collect the £250,000 top prize.
It continues a remarkable few months for him after he decided to change his life in the summer with an intensive fitness routine that saw him lose five stone in weight in a four-month period.
Since then he has now won back-to-back ranking events after taking the Northern Ireland Open last month, and also reaching the final of the British Open in October.
He is fifth in the world rankings and this was his second victory in a ‘Triple Crown’ event after lifting the 2018 Masters with victory over Kyren Wilson.
Allen again shows mental strength to win epic final
Allen had fought back from two frames behind in each of his matches in this tournament, but this fightback was on another level.
His semi-final win saw him come back from 5-3 down to beat Jack Lisowski on the final black in a match that finished at 23:15 on Saturday.
However, after two and a half hours of action at York Barbican on Sunday he found himself 6-1 down.
Allen had spoken of his mental strength after that semi-final victory, and again showed his character as he embarked on a stunning period of play that saw him collect 357 points without response as Ding went almost an hour of play without potting a ball.
Breaks of 79, 60, 93, 132, 56, 59 and 109 saw Allen win seven frames on the bounce.
Ding showed his frustration in the 15th frame by punching the table after losing position, but quickly regained his composure with a break of 105 to win his first frame in eight and threaten another change in fortunes.
But Allen won the 16th to move one frame away from victory and then got over the line when he edged a tight and tense 17th frame which lasted more than 40 minutes for an unforgettable win.
Ding misses out on Masters spot in painful loss
Ding landed this title as an 18-year-old in 2005 before victories in 2009 and 2019.
However, he has not won a tournament since that success three years ago, with the Covid-19 pandemic seeing him miss a number of competitions and then spend an extended period away from his wife and young child, who were back in China.
But this week had seen signs of a return to his best form for the former world number one.
Ding had dropped to 38th in the rankings, meaning he had to advance through two qualifying rounds just to get to York.
He produced a 6-0 thrashing of seven-time world champion Ronnie O’Sullivan in the quarter-finals and maintained that level of form in the opening seven frames as breaks of 52, 70, 126, 135 and 102 saw him race into what appeared to be a commanding lead.
Ding would have moved up to 10th in the rankings and made a return to the Masters in January but instead saw those hopes fade after a truly remarkable second session in a final that will live long in the memory.
- Sign up to My Sport to follow snooker news on the BBC app.