Former world number one Federer, 35, who lifted his 18th Grand Slam title at the Australian Open in January, had match points in the second-set tiebreak and also led 5-1 in the third-set breaker.
But world-ranked 116 Donskoy battled back to stun the third seed and set up a quarter-final clash against Lucas Pouille of France with a thrilling 3-6, 7-6 (9/7), 7-6 (7/5) victory.
"I surprised everyone today. I think whoever wins against Roger surprises himself," said Donskoy 26.
It was just the third time since 2007 that Federer has been beaten by a qualifier.
"I just never really got going tonight and sort of felt heavy. But look, those matches happen frequently, where you just got to somehow find a way to come through," said the Swiss legend, who was chasing a record eighth title at the Dubai Championships.
"Tonight I was convinced that if I came through I was going to feel better tomorrow. I came (to Dubai) early. I was perfectly prepared, it's just a tough loss tonight. So many chances... It was crazy."
"I just think it's still the beginning of the comeback and I've got to take the positives out of playing again a tournament where I feel I'm quite healthy and I'm happy I got over the injury I sustained at the Australian Open," he said.
- Murray cruises -
Top seed Andy Murray had no such trouble and said he was getting closer to his brilliant best as he hammered Guillermo Garcia-Lopez 6-2, 6-0 to surge into the quarters.
The world number one's rapid victory lined up a Thursday meeting with Philipp Kohlschreiber after the German beat Russian Daniil Medvedev 6-4, 6-4.
"It was very tough at the start, we both had chances in those early games," Murray, who has never won the Dubai showpiece, said.
"I played very well. I served better today than in the previous round. I'm certainly playing better than I did at the start of the year. Everything worked well tonight.
Murray and second-round victim Garcia-Lopez had not faced off since 2012, with the Spaniard winning their last meeting at Indian Wells.
But there was never a hint of a repeat.
After the first four games lasting half an hour, the pace picked up with Murray winning the first set.
He tightened his grip, losing just one point on his serve in the second set on his way to a dominant victory.
Disclaimer: No Business Standard Journalist was involved in creation of this content
You’ve reached your limit of {{free_limit}} free articles this month.
Subscribe now for unlimited access.
Already subscribed? Log in
Subscribe to read the full story →
Smart Quarterly
₹900
3 Months
₹300/Month
Smart Essential
₹2,700
1 Year
₹225/Month
Super Saver
₹3,900
2 Years
₹162/Month
Renews automatically, cancel anytime
Here’s what’s included in our digital subscription plans
Exclusive premium stories online
Over 30 premium stories daily, handpicked by our editors


Complimentary Access to The New York Times
News, Games, Cooking, Audio, Wirecutter & The Athletic
Business Standard Epaper
Digital replica of our daily newspaper — with options to read, save, and share


Curated Newsletters
Insights on markets, finance, politics, tech, and more delivered to your inbox
Market Analysis & Investment Insights
In-depth market analysis & insights with access to The Smart Investor


Archives
Repository of articles and publications dating back to 1997
Ad-free Reading
Uninterrupted reading experience with no advertisements


Seamless Access Across All Devices
Access Business Standard across devices — mobile, tablet, or PC, via web or app
