The Rocket took a 5-4 lead after both players made a series of errors in the first frame of the second session, but while O'Sullivan carried on in kind, Ding was by far the better player ahead of the mid-session interval.
He reeled off three consecutive and simple frames, the second with an excellent break of 118, to take a 7-5 lead into the mid-session interval.
But O'Sullivan responded with some vintage snooker and some brilliant break-building to grab a break of 94 and take the game to 7-6,
And he was lucky to take the next too after Ding potted a black, only to see the white ball cannon into the pack and pot a stray red as well. The Rocket responded by clearing up and falling just short of a century again with 89.
'Ridiculous' - Barry Hawkins sits in Neil Robertson's chair prompting cleaning delay
With the two playing top quality snooker, it was little wonder they could barely be separated as the session drew to a close, but O'Sullivan got himself into the lead with a third consecutive frame and a break of 73.
But Ding ensured that the two were neck and neck ahead of the final session with breaks of 41 and 53.
Luckily the Dutch official managed to temper tensions before any ongoing drama.
Watch shock confrontation between Anthony McGill and Jamie Clarke at World Snooker Championship
And McGill's mood barely improved as Clarke stretched his advantage to 8-2 with two quickfire frames.
Though Clarke eventually ceded some control as McGill grabbed two back for 8-4 ahead of the mid session interval.
The warring pair were quickly back at the table, and the pair sat in silence for the re-rack after McGill took the first of the restart to cut the deficit to 8-5 and then rattled off a further two to leave the score at 8-7.
Snooker took a backseat in the first frame as Robertson spilt coffee all over the crucible floor and his trousers, forcing both players to retire to their dressing rooms for a short moment.
"The most bizarre start to a match in Crucible history!" - Neil Robertson drink mishap
And the drama continued once they were back at the table as the two played out an incredibly tight and often error-strewn first session.
Robertson took a simple first frame but the two exchanged errors in the third allowing Hawkins to level.
Hawkins then threw away an epic third frame after missing a routine frame-ball black, but once again levelled things up at 2-2.
Robertson then edged a brilliant fifth frame following the mid-session interval as both players struggled to string together big breaks, and the Aussie then pulled away with an easy frame to go 4-2 ahead.
Hawkins finally gave us the first century of the session with a 111 clearance to go 4-3 behind, but Robertson responded with a century of his own to finish the session 5-3 up