Purdue led 21-19 in the fourth quarter, but the Boilermakers committed their sixth turnover on a sack of Elliott with 6:28 to play.
Northwestern (3-2, 1-1 Big Ten) grabbed its only lead when Mike Kafka took a shotgun snap and ran for a 2-yard TD with 2:09 left. Kafka's two-point conversion pass to Drake Dunsmore gave the Wildcats a 27-21 lead.
Purdue (1-4, 0-1) drove from its 16-yard line but couldn't score despite getting a first-and-goal.
Purdue led 21-3 but committed five turnovers in a span of about 17 minutes to help the Wildcats get back into the game.
Elliott passed for 313 yards and three touchdowns. Kafka passed for 224 yards and ran for 39.
On the Wildcats' first play from scrimmage, Arby Fields was stripped by Ryan Kerrigan, and Purdue's Torri Williams recovered at the Northwestern 34. Elliott took advantage by completing a 5-yard touchdown pass to Keith Smith with just 2:32 gone.
Northwestern got only a field goal out of a 20-play drive, and Purdue quickly made the most of its goal-line stand. Elliott's second touchdown pass came on a 67-yard screen to Valentin. After Valentin caught the pass, he stiff-armed a defender on the sideline and jogged into the end zone to give Purdue a 14-3 lead.
Elliott connected with Valentin again early in the second quarter. This time Valentin made a 5-yard catch in the back of the end zone to give the Boilermakers a 21-3 lead.
Northwestern followed with another 20-play drive that took 9:32, and this time, the Wildcats got nothing. Jacob Schmidt was stopped on a fourth-and-goal from the 1.
Elliott made his first mistake by throwing an interception to Sherrick McManis, and Northwestern quickly turned it into points. Fields scored on a 5-yard run to make it 21-10.
Valentin fumbled the kickoff, and Northwestern recovered at the Purdue 23. Stefan Demos then kicked a field goal to cut the gap to 21-13.
Jaycen Taylor fumbled with 39 seconds left in the first half, and Northwestern recovered at the Purdue 24. Demos kicked another field goal to trim Purdue's lead to 21-16 at halftime.
Northwestern ran 88 plays to Purdue's 57.