A rousing fightback from the Rocket teed up a nerve-jangling decider but McGill, the world No 16, showed all his big stage bottle to battle over the line in a heart-thumping 13-12 victory.
O’Sullivan had trailed 10-6 heading into the evening session after a ruthless Friday morning assault from McGill.
But the six-time Crucible king came flying out of the traps as breaks of 97, 73 and 71 reeled the Scot in and levelled at 10-10.
The pair exchanged a cagey couple of frames before O’Sullivan overcame a foul on his waistcoat to edge into a 12-11 lead.
McGill made a brilliant break of 136 in the 24th to take the game to a decider and after a mistake by O’Sullivan on the middle pocket, the Glaswegian held himself together to book a spot in the Sheffield quarter-finals.
The Rocket had raced into an early 4-1 advantage on Thursday morning as fluent visits of 138, 105 and 81 gave the returning Crucible crowd a long overdue source of entertainment.
But a stirring fightback from McGill saw him level heading into Friday morning’s second session, with the two-time ranking event winner making a fine seventh-frame 97 to keep O’Sullivan on his toes.
And a brutal Friday morning assault saw McGill open up a stunning 8-4 advantage, as breaks of 71, 126 and 89 left the Rocket slumped in his chair – and his title defence in tatters.
O’Sullivan, chasing Stephen Hendry’s record of seven World Championship titles, did pull one back in the 13th frame as a break of 89 cut McGill’s lead to three frames. But further efforts of 105 and 56 from the battling Scot opened up a remarkable 10-6 lead heading into Friday night’s climax.
Elsewhere yesterday, world No 3 Neil Robertson opened up a 9-7 lead against fellow left-hander Jack Lisowski in their last 16 clash.
The 2010 world champion, 38, made breaks of 137 and 113 in the second session to repel the world No 15’s advances.
Kyren Wilson reeled off six consecutive frames to help open up a 9-7 lead against 2013 runner-up Barry Hawkins, while Mark Williams led John Higgins 5-3.
Williams and Higgins boast seven World Championship titles between them but it was the Welshman who got the upper hand in the first session, striking breaks of 102, 101, 91 and 70.
Watch the World Snooker Championship live on Eurosport and Eurosport app from April 17- May 3
Support The Yorkshire Post and become a subscriber today. Your subscription will help us to continue to bring quality news to the people of Yorkshire. In return, you’ll see fewer ads on site, get free access to our app and receive exclusive members-only offers. Click HERE to subscribe.