Ding had taken a 2-1 lead in frames after being ground out of the opener by the 19th-ranked Davis, but failed to take his chances from there.
An 84 break to clinch the second frame was as impressive as his comeback from 61-0 down after Davis rattled frame black, but the Englishman pulled an impressive 85 to head into intermission all square.
Davis exploited several poor positional plays from the local lad to move ahead before an epic sixth frame came down to the final four colours, where Ding again fluffed his lines to find himself in serious trouble at 4-2 down.
Seizing the opportunity, Davis carefully crafted two mini-breaks in the final frame to advance to a last-16 tie with Jamie Burnett, who produced a similarly-unexpected result in knocking out Neil Robertson.
Another upset saw wild card entrant Fergal O'Brien defeat Crucible runner-up Ali Carter 5-3.
The Irishman stepped up his game from 3-3 after a marathon contest and his reward is a second round match against either Stephen Lee or Marcus Campbell.
Elsewhere in the opening round, Jamie Cope started and finished brightly to see off Martin Gould, also by a score of 5-3.
The all-English battle finished with a win for the 23rd seed over the number 12, and up next for Cope is world number one - and defending Wuxi title-holder - Mark Selby.
Stuart Bingham had to wait longer than he imagined he would to advance over Peter Ebdon 5-4 in a match which went so long, the ninth and deciding frame had to be carried over to the late session.
Either Shaun Murphy or Ken Doherty awaits the Basildon native, who staved off an Ebdon comeback attempt to finish the contest after wild cards Michael White and Zhou Yuelong had finished.
They too went to a decider in an unexpectedly exciting qualifier which saw the 14-year-old local clock up a 115 break on his way to seeing off the Welshman, making his first-ever appearance in the latter stages of a ranking event, in the ninth.
The teenager will now play Graeme Dott in the first round proper.
- Related links