The world number one was caught up by hurricane Hurkacz as he came off second best in all the razzle-dazzle shots the 22-year-old could throw at him and he was also banned from wearing his baseball cap by the umpire as it fell foul of Wimbledon's all-white rules.
However, Djokovic has not come to be known as Mr Consistency for nothing as he survived all the hullabaloo to reach the last 16 for the 12th time at the grasscourt major with a 7-5 6-7(5) 6-1 6-4 win.
"I congratulate Hubert for putting a great effort today," said four-times champion Djokovic, who will meet Canadian tyro Felix Auger-Aliassime or France's Ugo Humbert.
"He was fighting, he was playing well, serving well, hitting clean and accurate shots from the back of the court and it was a great fight the first couple of sets.
"Credit to him for playing high quality tennis because I really enjoyed it.
"I played a perfect third set and a solid fourth set and I am pleased with the performance."