First, Sharapova went down to qualifier Camila Giorgi, 6-3, 4-6, 7-5, giving the young Italian her first victory over a top-five player. Then, Nadal followed on the main stadium court, losing 6-3, 3-6, 7-6 (5) to Alexandr Dolgopolov of Ukraine.
Nadal staged a furious rally in the third. He won three straight games, including a break of Dolgopolov, to tie it at 5. Both players held serve to send the match into the tiebreaker.
They slugged it out from the baseline accompanied by a noisy soundtrack, with fans yelling and cheering. Los Angeles Lakers star Pau Gasol watched nervously from Nadal's box. Nadal led 4-2 before Dolgopolov won three straight points to take a 5-4 lead. The Ukrainian hit two forehand winners and came up with a big service winner.
"I had enough breaks to win the match, but I didn't play enough well from the baseline then to be solid with my serve," Nadal said. "I didn't go for the points. I played with too many mistakes."
Nadal evened it at 5-all, but he hit the ball long to set up match point. Dolgopolov served what he thought was an ace, but it was called out. He challenged the call and it showed the ball barely missed tagging the T. Dolgopolov put his second serve into play and produced a cross-court forehand that the world's top-ranked player couldn't return.
"It's a moment for the people to be proud a little bit for someone from their country," Dolgopolov said, referring to the political upheaval going on between Ukraine and Russia. "It's good to make some results and make the people forget a little bit and have some happy moments in the news."
Dolgopolov had more errors (49) than winners (36).
Last month, Nadal defeated Dolgopolov to win the Rio de Janeiro title. The Ukrainian has risen quickly in the ATP Tour rankings, going from No. 57 to 31st after a strong February, posting three wins against top-20 players in Rio and made the semifinals in Acapulco.
Before Nadal was sent packing, Sharapova committed 58 errors in her first loss to a player ranked outside the top 30 since Wimbledon last year.
"She's someone that doesn't give you much rhythm," Sharapova said. "She's quite aggressive, but some shots she hits incredible for a long period of time. Sometimes they go off a bit. If I'm speaking about my level, it was nowhere near where it should have been."
Ranked 79th in the world, Giorgi made it through qualifying to play Indian Wells for the first time. She improved to 3-2 against top-10 opponents. The 22-year-old led 4-2 in the final set, but Sharapova brokeGiorgi twice to tie it at 5.
"I was trying to just play my game, and maybe I accelerate more than the other set," Giorgi said. "I just play more aggressive."
Giorgi then broke Sharapova at love before serving out the match, overcoming her 11th double fault to set up match point. Giorgi had 48 unforced errors and 24 winners.
Awaiting Giorgi in the fourth round will be fellow Italian Flavia Pennetta, who beat No. 16 seed Sam Stosur 6-4, 3-6, 6-1.
Tied 4-all in the third, Sharapova was broken when her forehand was called long and Sharapova raised her arms. The chair umpire took the gesture to mean Sharapova was challenging the call, and the call showed the ball was out.
Sharapova argued she was only throwing her arms up as if to ask, "Who made the call?" But the umpire disagreed, and Sharapova retreated to her sideline chair trailing 5-4.
Australian Open champion Stan Wawrinka routed 29th-seeded Andreas Seppi of Italy 6-0, 6-2.
Andy Murray outlasted Jiri Vesely of the Czech Republic 6-7 (2), 6-4, 6-4 in his second straight three-set match, and four-time tourney champion Roger Federer defeated 27th-seeded Dmitry Tursunov of Russia 7-6 (7), 7-6 (2) with an ace on match point.
Murray had 47 of the 99 unforced errors during the nearly three-hour match in the 80-plus-degree heat of the Southern California desert. The third set featured six service breaks, with Murray taking the last two.
Top-seeded Li Na defeated Karolina Pliskova of the Czech Republic 6-3, 6-4, while American Sloane Stephens beat 11th-seeded Ana Ivanovic 7-6 (3), 6-4.