World number one O’Sullivan was whitewashed in a Triple Crown event for the first time in his 30-year career and scored just four points in the final four frames.
The 46-year-old, who has won the UK title seven times, said: “It’s great to see Ding play well. He’s a class act. Afterwards I just said to him ‘you played great, go and win it, get the job done.’ I think we’re all Ding fans.
“Some days you play and it goes great and some days it doesn’t. It was just one of those days, what can you do? Thirty years I’ve been at this game, I’ve taken a few knocks along the way.”
Ding punished O’Sullivan for several mistakes in the opening two close-fought frames and from 2-0 up, the Chinese world number 38 never looked back.
The 35-year-old compiled successive breaks of 88, 94, 87 and 131 in each of the next four frames to edge closer to the £250,000 winner’s prize and his fourth UK crown after winning the event in 2005, 2009 and 2019.
Ding will play Tom Ford in Saturday afternoon’s semi-final after the world number 32 beat Joe Perry 6-4 in his quarter-final.