Linebacker Gilbert Gardner's 19-yard fumble return for a touchdown late in the third quarter highlighted the comeback as Purdue roared back from a 17-0, first-quarter hole with 34 straight points.
"Our defense didn't surrender any points throughout the game," Purdue Coach Joe Tiller said. "We played with great resolve and came back in the second quarter, giving us confidence in the locker room. As a football team, we haven't rolled over all year long."
The Big Ten improved to 3-0 in bowl play and has four more teams in action over the next three days, including No. 2 Ohio State, which faces top-ranked Miami in the national championship game on Friday in the Fiesta Bowl.
The Pac-10 Conference, meanwhile, dropped to 1-4 in bowl play. The Pac-10 has two teams -- Southern California and Washington State -- involved in BCS bowls.
Making its second straight Sun Bowl appearance, Purdue (7-6) avenged a loss to Washington in the 2000 Rose Bowl and defeated the Huskies for just the second time in 10 all-time meetings (2-7-1).
Tiller has not had a losing season in his six years at Purdue.
Washington (7-6) appeared ready to turn the game into a blowout as Cody Pickett tossed a seven-yard touchdown pass to Patrick Reddick, Marquis Cooper returned a fumble 31 yards for a score and John Anderson kicked a 39-yard field in the first 11 minutes.
Washington outgained Purdue, 94 yards to minus-8 in the first quarter, but the Boilermakers' defense settled down. The Huskies' next seven possessions resulted in five punts, an interception and a fumble.
Purdue got on the board on Kyle Orton's seven-yard toss to John Standeford with 5:09 left in the second quarter, then closed to within 17-14 when wide receiver Ray Williams recovered Brandon Jones' fumble in the end zone with 35 seconds left in the half.
Orton threw for 283 yards and completed 25 of 37 passes -- exactly half his number of attempts in last year's 33-27 Sun Bowl loss to Washington State. He threw for 702 yards in the two games.
"The biggest thing was winning this game," Orton said. "I took all the snaps and played well enough to win. We had to get going fast to overcome the deficit."
Standeford caught 10 passes for 105 yards, while Taylor Stubblefield grabbed seven for 92.
"They motivated us with all the trash-talking that was taking place," Standeford said.
While Pickett was 25 of 54 for 272 yards, the Huskies rushed for just 44 yards on 24 carries.
The defeat saddled Washington with just its second six-loss season in 25 years. The Huskies won their final three regular-season games to avoid their first losing year since 1976.
"Even with a 17-0 lead, we were not playing well and we weren't clicking," Washington Coach Rick Neuheisel said. "We left our defense on the field too long."
Following a 22-yard field goal by Berin Lacevic early in the second half, the Boilermakers took the lead for good on Jones' 10-yard run with 3:33 left in the third quarter.
Just 85 seconds later, Gardner stripped Pickett, scooped up the fumble and went the distance to make it 31-17.
"We had a lot of mistakes," Reddick said. "We didn't execute, get open. We were dropping the ball and we weren't hitting our targets."
The Boilermakers kept the ball out of Pickett's hands with a seven-minute possession in the fourth quarter that Lacevic capped with a 29-yard field goal with 5:52 to go.
Purdue rolled up 408 yards over the final three quarters and finished with a 400-316 advantage. A large chunk of Washington's total came on its final two possessions.
The Huskies got within 10 on Pickett's 12-yard strike to Patrick Reddick with 3:31 left before Anderson missed a 23-yard field goal with 15 seconds to play.