Su-Wei Hsieh of Taipei
World number one Osaka had looked in little danger after winning the first set and moving a break ahead in the second.
But Taiwan's Hsieh, who was a set and 4-1 up in Melbourne earlier this year before losing to the Japanese star in the third round, battled superbly to leave the Miami Open wide open following the withdrawal of Serena Williams on Saturday afternoon with a knee injury.
"This was a very emotional win for me," said Hsieh who hit 39 winners, one less than her opponent, with both winning 69% of points on their first serves. "Any time you beat one of the top players it is amazing."
Osaka's second-round win over Belgian Yanina Wickmayer on Friday saw a second set wobble from the two time Grand Slam winning star and it was more of the same against Hsieh, who simply refused to give up the fight.
The 33-year-old will play either Caroline Wozniacki or Monica Niculescu in the fourth round.
Hsieh certainly made an impressive start on the main court of the new look Miami Open, breaking Osaka immediately and establishing an early 4-1 advantage.
But Osaka managed to compose herself and claw back to 4-4 and then broke once again to land the opening set.
And when the reigning US and Australian Open champion produced a brilliant crosscourt backhand to break her opponent’s serve at the start of the second set, Hsieh looked down and out.
Osaka, however, was broken when serving for the match as the 27th-ranked Hsieh regained some momentum and took full advantage of her opponent's dip in form to take the match into a deciding set which was superbly won by the Taiwanese.
Osaka's defeat follows her fourth-round exit last week at Indian Wells, where she was the defending champion.
In the men’s draw, there was a surprise in the opening match on Hard Rock Stadium's center court as world number 33 Stan Wawrinka was beaten 7-5, 2-6, 7-6 (7/5) by 103rd-ranked Serbian Filip Krajinovic.