Leicester’s world number one Selby lost 4-2 to the Chinese in the sixth round of the event, and it looked like he could go home without a frame after Ding moved 4-0 ahead thanks to breaks of 96 and 79.
But Selby took the final two frames, with a run of 52 in the last a highlight.
Selby lies bottom of Group A with matches against Shaun Murphy and Stuart Bingham remaining.
In the night’s other match John Higgins twice came from behind against Stephen Lee to also win 4-2.
The Scot was 1-0 and 2-1 down but he took the final three frames, thanks in part Lee missing a pink and black combination that would have levelled at 3-3.
Higgins is level with Judd Trump atop Group B, with both on two wins out of two.
The next round of the Premier League is in Penzance, with Lee in action against Mark Allen and Bingham facing Neil Robertson.