The world number 84 made a quick start that caught Murray off guard to build a 5-1 lead in the first set.
Murray battled back to win the next four games but with the first set finely poised at 5-5, he missed six chances at break point.
Donskoy survived and rubbed salt in the wound to break himself and claim an entertaining opening set.
Murray, who traditionally struggles in the opening round at Indian Wells, returned to form and claimed the second set in 35 minutes thanks to a double break of serve.
The Russian's will was broken early in the decider as Murray claimed the opening game with a pair of ruthless backhand drives on second serve.
After spending just over two hours on court Murray eventually wrapped up a 5-7 6-2 5-2 victory in his first competitive match since losing the Australian Open final.