Maverick Vinales took his third 125cc victory at Sepang, as Nico Terol's championship celebrations were postponed in a dramatic last lap.
For most of the race it looked like Terol would do enough to become the last world champion of the 125cc era in Malaysia, for despite his title rival Johann Zarco mounting a gallant charge through the field, Terol looked set for the race win.
But mistakes from Terol with victory in sight saw him fall to fifth, with Zarco (Ajo Derbi) making it through to third behind Blusens Aprilia rider Vinales and second-placed Sandro Cortese (Team Germany Aprilia)
After a messy qualifying session yesterday, Zarco surged through from 15th on the grid to fifth on the opening lap, then quickly made it up to third, as Terol led from Vinales.
But that would be as high as Zarco could get, as while he stayed on the heels of the top two, he was embroiled in a battle with Terol's Aspar team-mate Hector Faubel and Cortese.
Then in the middle of the race the title rivals were brought together, as Vinales finally made it past Terol, and Cortese pounced to demote him to third - just in front of Zarco.
The Frenchman then outbraked Terol to take third, only to lose the place again to the Aspar rider's superior straightline speed soon after.
Terol then picked his way back to the front, passing Cortese and benefiting from Vinales running wide at the last corner with six laps to go.
With Vinales and Cortese then getting caught up in their own battle for second, Terol appeared to be cruising to victory and the title - until the pack closed back in on him and a minor error on the penultimate lap saw Vinales and Cortese sweep past.
Worse was to follow on the last lap as, under pressure from Zarco, Terol slid off the road and fell to fifth, with Zarco coming through to complete the podium as Vinales narrowly beat Cortese to victory in a massive figth.
Jonas Folger (Ajo Aprilia) was a lonely sixth after sparring partner Efren Vazquez crashed on the last lap.
Home rider Zulfahmi Khairuddin (Ajo Derbi) claimed a career-best seventh to the delight of the Malaysian crowd, beating Jakub Kornfeil (Ongetta Aprilia), Alberto Moncayo (Andalucia Aprilia) and Danny Kent (Ajo Aprilia).