The former world No 1 had been forced to endure three qualifying rounds just to walk out at the Crucible – after dropping out of the top 16 players – and let a 4-1 lead slip to trail Martin Gould 8-6.
But Sheffield-based Ding – who has lived in the Steel City since he was a teenager – reeled off four successive frames to win 10-8 and secure a second-round match with either Judd Trump or Liang Wenbo.
World No 12 Gould – a former casino croupier – had enjoyed the best season of his career, winning his first ranking title at the German Masters.
But 29-year-old Ding – whose best performance in his adopted hometown was a semi-final spot in 2011 – came into the tournament in fine form, losing just seven frames in his three qualifying round matches. And he raced into a 4-1 lead after breaks of 90, 110, 49, 54 and 87.
Having never got beyond the second round in Sheffield in six previous visits, Gould needed to keep in touch and a 64 break pulled a frame back to make it 4-2.
The 34-year-old came out on top in a scrappy seventh frame, to cut the deficit to 4-3. The pair then traded punches, Gould’s swashbuckling clearance of 111 the perfect riposte to Ding’s 87.
When the match resumed last night, it was Gould who edged a drawn-out opening frame to level the match at 5-5. Breaks of 53 were enough for the pair to share the next two frames, before a 96 clearance put Gould ahead for the first time, at 7-6. And it was 8-6 when Gould pinched the next frame, despite needing three snookers at one point.
Ding was wobbling and needed a response, cracking in 132, 86 and 100 to edge in front 9-8, before keeping his nerve in the final frame to get over the winning line.
Former UK champion Trump is in danger of joining the exodus of top-five seeds at the first hurdle in Sheffield.
With defending champion Stuart Bingham, plus former winners Shaun Murphy and Neil Robertson already out, only Mark Selby of the top five players have qualified for the second round so far.
Fifth seed Trump trails China’s Liang Wenbo 6-3 when their match resumes on Thursday. But there were first-round wins for Mark Allen, after a 10-3 win over qualifier Mitchell Mann, and Barry Hawkins, who beat Zhang Anda 10-5.