Pye achieved his first win in the championship having had to persevere on slick tyres as heavy rain fell at the Melbourne circuit with eight laps remaining.
The Walkinshaw Andretti United driver looked to be managing a comfortable margin, which peaked over 4.5s, when he made an error with just over two laps to run.
Pye ran into the edge of the run-off at Turn 13 but just managed to regroup, keep in front of Whincup and a closely following Nick Percat, and go on to win.
Whincup said that he was happy for the South Australian native to notch up his first victory, having survived two offs of his own on his way to taking out Race 4 earlier in the day.
“Scotty went off at the end of the back straight and I was pretty close,” the 109-time race winner said when asked about his race by Speedcafe.com.
“I was actually hoping he got away with it because I got away with it this morning, so it's good that it evened out.
“I would've felt bad if I got that one after getting away with it this morning.
“He made a mistake but defended well so there was just no opportunity to pass.
“If there was an opportunity, I would've taken it, but he drove well.
“Well done to Scotty and his crew, they did a great job.”
Whincup's runner-up finish came having qualified fourth and made a daring move past Nick Percat via the grass at the start.
Like Pye, he moved up a position when pole-sitter and early leader Scott McLaughlin ran off the track at the start of Lap 2, before also choosing to stay out on slicks as the rain came down.
“The car was good today,” recounted Whincup.
“We started from fourth because I made a mistake in qualifying.
“We got off to a good start, we had Scotty's pace at the start there and we elected to stay out when it rained.
“We read the track conditions and what was (on) the radar well and made the right call today to stay out.
“We're happy to collect some good points. We're off the pole tomorrow, so if we do a good job we should try to stay somewhere there or thereabouts.”
The Supercars program concludes with Race 6 over 13 laps tomorrow from 1345 local time/AEDT.