The 42-year-old two-time world champion trailed 6-3 but runs of 62, 90 and 58 saw him level, only for 17-year-old rising Chinese star Yan to produce a 59 to regain the lead.
Williams again dug deep to level at 7-7 and again at 8-8 before he held his nerve to take a dramatic decider 77-28 thanks to an early break of 42 and some dogged safety play.
The Welshman collected the trophy to win 60 points of profit for backers of Crawford's 40/1 each-way selection.
Crawford wrote in his preview: "He remains a fine player and this season has won the Six-red World Championship and reached the semi-finals of the Riga Masters, as well as the last eight of the China Championship, World Open, European Masters and last week's Shanghai Masters where he was beaten by O'Sullivan.
"Williams is still more than capable of winning a ranking title and arrives in Belfast in better form than most of the assembled field."
Williams had beaten Elliott Slessor - Ronnie O'Sullivan's conqueror - 6-2 in his semi-final on Saturday but later revealed on Twitter that his wife Joanne had been taken to hospital, adding: "Last thing I want is too pull out now but we will have 2 wait and c".
Just after 11am on Sunday, two hours before play was due to start against Yan, Williams tweeted: "Right, better get ready for the first session of the final then"
World Snooker chairman Barry Hearn was among those to show support as he responded: "Good luck Mark. Hope all is well back home."
Before the final session, Williams added: "1 more session to go then home it is to be with the Mrs in hospital, perhaps where I should have been from the start. #onelastpushwillo"
It was a first ranking title since 2011 for left-hander Williams, scuppering the hopes of Bingtao of becoming the youngest ever player to win one - a record held by O'Sullivan.
After the match, Williams told Eurosport: "I did say to myself a while ago, if I could get to 20 ranking titles I would be over the moon. I'm on 19 now so just one more away. You never know.
"I felt really good. The first eight frames were the worst I had played, but tonight I back to playing really good again.
"He was just potting everything for fun. He is only 17 and is only one frame away from beating Ronnie's record. If he keeps improving he is going to be winning many tournaments."
Related links