Italy's world No48 produced an inspired serving performance, denying Federer even a break point until midway through the second set.
Each game Bolelli won was met by just a smattering of applause from a stunned Rod Laver Arena.
Federer's attempt to win his 18th major had almost unanimous support on Melbourne Park's centre court, where he's saluted four times previously.
At the ninth time of asking, Federer finally broke Bolelli with an outrageous defensive backhand that had no right to find the far corner.
He tied the match at a set apiece and shifted gears.
Putting more pressure on the Italian, Federer broke Bolelli's serve twice in each set and walked off court a winner.
He explained a quick moment with his trainer was to work out how to treat the sting.
"It felt like a bee stung me, but I was like 'this can't be possible'," he said. "I've never had this pain before.
"It was disturbing me. I knew that to tape it wasn't the option.
"Thankfully, it wasn't as bad as the end."
There was no doubt about Murray's progression as he steamrolled Australian Marinko Matosevic.
The three-time runner-up made short work of the Victorian, winning 6-1, 6-3, 6-2 in 102 minutes.
Murray crushed Matosevic's spirit in a 21-minute opening set and made just 12 unforced errors for the match. By contrast, Matosevic made 49 blunders.
Berdych too was largely untroubled in his straight-sets defeat of Austrian Jurgen Melzer in just two hours and three minutes to set up a meeting Viktor Troicki in the third round. Troicki continued his fine 2015 form by defeating 26th seed Leonardo Mayer in four sets.
Dimitrov defeated Lukas Lacko while rising Belgian and 20th seed David Goffin was beaten by 2006 Open finalist Marcos Baghdatis, and 24th seed Richard Gasquet beat Australian wildcard James Duckworth.