In a late-night thriller in Sheffield, the world number 73 hit a break of 103 to force a deciding frame, which he promptly won to book a spot in the second round.
Ding was one of the pre-tournament favourites, having claimed a record-equalling five ranking titles so far this season, but he fell at the first hurdle in one of the biggest upsets witnessed at the venue.
Wasley, playing just his second season on the main tour, had to win four matches to reach the Crucible but at times his play belied his lowly status.
Confident potting and a cool head characterised the Gloucester potter's display as he set up a meeting with either Mark Davis or Dominic Dale in the second round.
"I feel great, I managed to hold my nerve in the end," said Wasley. "I was really nervous but I managed to put that to the back of my mind, I knew I had a match to win and it was in my hands. I'm just glad I held it together.
"Coming out playing one of the favourites of the tournament and someone who's had such a great season and dominated, I was really pleased to be 9-9 and in with a chance to win. I wouldn't be playing the sport if I didn't think I could beat anybody and I felt like I adapted to the Crucible straight away - I could just get down to business and on to the match.
"It will take a good night's sleep to get over it. The crowd were great, they really brought me along and it's great playing in front of them performing - I just want to do it all again tomorrow."
Ding's wait for his maiden world championship continues.
The Chinese said: "I had many chances but I didn't take them. Sometimes the cushions bounced and took me out of position, which kills me and my game and costs me the frame.
"I was a bit surprised he played so well. In the first session he didn't play like that in the last few frames. He made a big break to come back to 9-9. I had some bad luck in the last frame but I tried the best I could."
In another late-finishing, 19-frame match, Mark Selby edged Michael White to keep alive his hopes of going one better than his final appearance in 2007, when he lost the championship decider to John Higgins.
Selby, the world number two, weathered a rousing comeback from White to post a 10-9 victory that sees him through to a meeting with Ali Carter.
"Relief is probably the right word to use," said Selby. "It was a strange game because I thought I played really well. If you look at the breaks, I scored six or seven one-visits out of the 10 frames I've won.
"All you can ask for in a deciding frame is to have a chance. If you have that chance and you take it then great, but if not then you can't complain."
Earlier Joe Perry produced a stirring fightback to beat Jamie Burnett 10-7 and set up a match against Ronnie O’Sullivan.
Perry is currently enjoying a purple patch – the best of his career – after claiming the Yixing Open, and continued in his rich vein of form as he fought back from 6-3 down to advance into the second round.
Early breaks of 87 and 70 enabled the Chatteris cueman to pull within one frame of Burnett, and he kept up the pressure to take the final two frames before the interval to lead 7-6.
Perry returned from the break carrying the momentum and looked to take a clean sweep of frames, only for Burnett to pull one back at 9-6, though the match was soon wrapped up with a final break of 81.
"I was pleased with myself today, I just stuck with it and dug in," said Perry, who reached the semi-finals here in 2008. "I don't think I played that bad yesterday, it was just Jamie played a lot better and punished me for my mistakes. I knew that I was going to get chances but had to make more of them.
"I got a few chances in the first session and didn't really capitalise. I never really settled with the pace of the table and couldn't get control of the cue ball. I just started chasing the game and chasing breaks.
"He got better and I got worse and that's why it was a 6-3 scoreline. I was a bit more patient today and decided to take whatever was there today and not go searching for things.
"You don't get any tougher than Ronnie O'Sullivan but saying that I would've been gutted sitting at home watching Jamie playing him. I've played Ronnie so many times, including here at the Crucible.
"He's just a joy to watch but we've all got to believe that we can win and if we can play our best and cut out the errors and he perhaps isn't firing on all cylinders, then he's beatable."
- Sports & Recreation
- Mark Selby