The Dane, top seed at the event in Kuala Lumpur, cruised through the opening set of her first round clash and had a match point in the second before going down 2-6 7-6 6-1.
Qualifier Wang, 21, allowed Wozniacki only one point in the second set tie-break as she levelled the match and rolled through the decider to claim her biggest career win.
Wozniacki, a semi-finalist last week in Dubai, has slipped to 10th in the world rankings.
Wang will face Austrian Patricia Mayr-Achleitner next.
The Malaysian Open is a hard-court tournament with a £154,330 prize fund.
Venus Williams was taken to three sets by Garbine Muguruza Blanco but eventually claimed a 6-4 2-6 7-5 victory to put the American into the quarter-finals of the Brasil Cup.
Williams, ranked 20 in the world - 76 places higher than her Spanish opponent - squandered three match points before finally sealing the win at the fourth time of asking in the Brazilian city of Florianopolis
The top seed will now meet Magdalena Rybarikova of Slovakia for a place in the semis, after she beat Beatriz Garcia Vidagany of Spain -4 3-6 6-4.
Italy's Sara Errani continued her good form at the Acapulco International by progressing to the last eight with a 7-6(4) 6-2 win over Canada's Eugenie Bouchard.
Errani, the top seed and favourite at the tournament in Mexico, is defending her title - one of four she won last season, all of which were on clay.
She next plays Kiki Bertens, the Dutch fifth seed who booked her place in the quarters with a 6-1 6-2 win over Spain's Maria Jose Martinez Sanchez.
Malaysian Open results
2-Hsieh Su-Wei (Taiwan) beat Zhang Shuai (China) 6-2 6-2
Patricia Mayr-Achleitner (Austria) beat Wang Qiang (China) 6-3 6-2
3-Anastasia Pavlyuchenkova (Russia) beat Akgul Amanmuradova (Uzbekistan) 6-3 6-3
Ashleigh Barty (Australia) beat Zarina Diyas (Kazakhstan) 7-6(3) 6-4
Luksika Kumkhum (Thailand) beat 7-Eleni Daniilidou (Greece) 6-2 6-4
Karolina Pliskova (Czech Republic) beat 5-Misaki Doi (Japan) 6-4 7-6(7)
Bethanie Mattek-Sands (U.S.) beat Duan Yingying (China) 6-1 6-4
4-Ayumi Morita (Japan) beat Nudnida Luangnam (Thailand) 6-3 6-1
2-Hsieh Su-Wei (Taiwan) beat Kurumi Nara (Japan) 6-7(5) 6-3 6-4
Wang Qiang (China) beat 1-Caroline Wozniacki (Denmark) 2-6 7-6(1) 6-1
7-Eleni Daniilidou (Greece) beat Yuliya Beygelzimer (Ukraine) 2-6 6-4 6-3
Luksika Kumkhum (Thailand) beat Olivia Rogowska (Australia) 3-6 6-1 6-2
4-Ayumi Morita (Japan) beat Cagla Bueyuekakcay (Turkey) 6-1 6-1
Ashleigh Barty (Australia) beat Chanel Simmonds (South Africa) 6-4 6-2
Akgul Amanmuradova (Uzbekistan) beat Chang Kai-Chen (Taiwan) 6-1 6-3
Duan Yingying (China) beat Marta Sirotkina (Russia) 6-3 4-6 7-6(12)
3-Anastasia Pavlyuchenkova (Russia) beat Vera Dushevina (Russia) 2-6 6-3 7-6(6)
Zarina Diyas (Kazakhstan) beat 8-Kristyna Pliskova (Czech Republic) 6-7(5) 6-1 7-5
Nudnida Luangnam (Thailand) beat Zheng Saisai (China) 6-3 6-7(1) 6-2
Zhang Shuai (China) beat Aslina Chua (Malaysia) 6-0 6-1
Brasil Cup results
1-Venus Williams (U.S.) beat Garbine Muguruza Blanco (Spain) 6-4 2-6 7-5
5-Magdalena Rybarikova (Slovakia) beat Beatriz Garcia Vidagany (Spain) 6-4 3-6 6-4
Monica Niculescu (Romania) beat Tereza Mrdeza (Croatia) 6-1 6-1
Melinda Czink (Hungary) beat Beatriz Haddad Maia (Brazil) 1-6 6-2 7-6(3)
Olga Puchkova (Russia) beat Caroline Garcia (France) 3-6 6-3 6-3
7-Kristina Mladenovic (France) beat Tatjana Malek (Germany) 6-2 6-1
Timea Babos (Hungary) beat 4-Chanelle Scheepers (South Africa) 6-1 6-2
Acapulco International results
3-Alize Cornet (France) beat Estrella Cabeza Candela (Spain) 6-4 6-4
Karin Knapp (Italy) beat 8-Romina Oprandi (Switzerland) 6-4 7-6(2)
2-Carla Suarez Navarro (Spain) beat Stephanie Foretz Gacon (France) 6-1 6-2
7-Lourdes Dominguez Lino (Spain) beat Maria Teresa Torro (Spain) 6-4 3-0 (Torro retired)
5-Kiki Bertens (Netherlands) beat Maria Jose Martinez Sanchez (Spain) 6-1 6-2
1-Sara Errani (Italy) beat Eugenie Bouchard (Canada) 7-6(4) 6-2
6-Francesca Schiavone (Italy) beat Sesil Karatantcheva (Kazakhstan) 6-3 6-4
Silvia Soler Espinosa (Spain) beat 4-Irina Begu (Romania) 6-1 2-1 (Begu retired)