The 20-year-old took the first set on a tie-break and caused problems for her illustrious opponent throughout as she sought to follow up her upset of Sabine Lisicki on Monday.
But the world number two eventually prevailed 6-7 (7/9) 6-3 6-4 in three hours and 10 minutes.
Watson was broken in the first game of the match but hit straight back, breaking to love in the second.
Sharapova took a 6-5 lead but failed to serve out the set, serving consecutive double faults before Watson forced a tie-break with her third break point.
The Guernsey player then came from 3-0 down to win the tie-break 9-7, in the process saving set points for the second and third times.
Sharapova broke early in the second set but again Watson responded, and the Russian had to battle to hold for a 3-2 lead as her fragile serve gave her more problems, though she won the game with a fine sixth ace of the match.
Three successive breaks followed, Sharapova with two of them to take control before serving out the set 6-3.
For the third set in succession, Watson lost her first service game - but again she found the same response, levelling at 1-1.
Sharapova recorded the third break in succession - each sealed by a double fault - but Watson made it seven in eight games to level once more.
Sharapova broke for the eighth time in the match to lead 4-3 and, serving at 5-4, an ace set up two match points and she closed the match out at the first attempt.
Petra Kvitova was the biggest casualty of the day after she was stunned in straight sets by Petra Martic.
The number four seed has struggled in the second half of the season and her woes continued today with a 6-4 6-4 defeat.
World number one Victoria Azarenka had no such problems in booking her place in the last 16.
The reigning Australian Open champion dismissed Austria's Tamira Paszek 6-1 6-1 to set up a clash with Roberta Vinci, who also had few troubles in her routine 6-3 6-1 victory over Pauline Parmentier.
Third seed Agnieszka Radwanska and her younger sister Urszula saw off the challenges of two former world number ones.
Agnieszka comfortably dispatched Jelena Jankovic 6-2 7-5, making it a day to savour for the Radwanska siblings after Urszula had earlier upset former French Open champion and 11th seed Ana Ivanovic.
Fifth seed Angelique Kerber eased past wild card Ayumi Morita 6-3 6-4 and Sara Errani, seeded sixth, was a 6-3 7-6(7/1) winner over Swedish qualifier Johanna Larsson.
Li Na and Samantha Stosur, seeded seventh and eighth, were both taken to three sets before prevailing against Anastasia Pavlyuchenkova and Francesca Schiavone respectively.
There were also wins for seeds Marion Bartoli, Caroline Wozniacki, Dominika Cibulkova, Lucie Safarova and Nadia Petrova, but there was no suck luck for 15th seed Kaia Kanepi, who suffered a 5-7 6-2 6-3 defeat by United States qualifier Jamie Hampton.