Hansen, who was signed from Nijmegen in August, scored his first goal for Rob Edwards' side in stoppage time to extend their unbeaten start to the second-tier campaign.
Lewis Dobbin had given Preston a half-time lead and after Matt Targett volleyed Middlesbrough level, it appeared Jordan Storey's late header would seal the points for Preston before Hansen had the last word.
Stoke climbed to second place as Bosun Lawal's first goal for the club clinched a 1-0 home win against Birmingham, who slipped to successive league defeats for the first time under boss Chris Davies.
Bristol City are up to third after they maintained their unbeaten league start with a 3-0 win at Sheffield Wednesday, thanks to Harry Amass' own goal and strikes from Emil Riis and Anis Mehmeti.
West Bromwich Albion missed the chance to close the gap on the leaders after losing 1-0 at home to Derby, with Andreas Weimann firing the late winner.
Ricardo Pereira rescued 10-man Leicester in a 2-2 draw at Oxford.
Aaron Ramsey was shown a straight red card on his Foxes debut for his reckless 23rd-minute tackle on Filip Krastev.
Raees Bangura-Williams' 88th-minute equaliser for Millwall stopped Charlton beating their south London rivals for the first time since 1996 with a 1-1 draw.
Charlton led through Sonny Carey's first-half strike at The Valley.
But Nathan Jones' side had Kayne Ramsay sent off for two bookings in the second half before Bangura-Williams came off the bench to extend Millwall's long unbeaten run against the Addicks.
Hull defender John Egan's stoppage-time equaliser salvaged a 2-2 draw at Swansea.
Coventry forward Haji Wright netted deep into stoppage time to earn a 1-1 draw against Norwich.
Wrexham remain winless at home this season as they lost 3-1 to QPR.
Japan midfielder Ryoya Morishita's first goal for Blackburn secured a 1-0 win at Watford.