Making the matter even messier, the car then picked up the field behind Whincup a lap later, causing riders such as Lee Holdsworth, who was in second at the time but waited behind the safety car until being waved through, to tumble out of the top 10 through no fault of his own.
His team principal Tim Edwards was fuming at the error.
"There's a whole group of cars behind Jamie that had all pitted so it's a monumental stuff up - inexcusable," Edwards said.
"It's hard to calm them down because, even sitting in the cockpit, they know there's been a stuff up. They're just irate."
For his part, Whincup was given a drive-through penalty, ending his chances of claiming his second win of the season, after he had qualified on pole.
Instead, through all the drama came McLaughlin, who beat Craig Lowndes' 1996 record for most victories in a season when he crossed the line ahead of Shane van Gisbergen and Chaz Mostert.
Greeted by Lowndes in victory lane, McLaughlin laughed he had "completely forgotten" about the record.
"I wanted so badly to do this on New Zealand soil and I'm stoked. I'm really proud of our team to be up there with a guy like [Lowndes].
"I'm a lucky guy driving a cool car and just a proud New Zealander trying to do my thing."
McLaughlin started in fifth, and held the advantage once every car had completed their pit stops with 20 laps to go. From there, he controlled the race, winning by 1.9 seconds over van Gisbergen, with Mostert narrowly holding off Nick Percat for third.
The victory extends his lead in the championship to a mammoth 598 points over van Gisbergen ahead of Bathurst next month.