Hanson's 19-yarder with 3 seconds left in regulation produced a 23-23 deadlock. He later added 45-yard score after the Lions picked up 23 yards on five plays in overtime.
The veteran kicker finished the day 4-for-4 on field goals while moving into third place on NFL's all-time scoring list.
The Lions trailed 23-13 with 5 minutes left in regulation but Matthew Stafford (22-for-45 311 yards, one touchdown, one interception) led them on three scoring drives down the stretch.
The Lions (2-3), who won for the first time since the opening week, got six catches for 135 yards from Calvin Johnson.
Michael Vick tossed two touchdown passes while going 28-for-46 for 311 yards for the Eagles (3-3), but he was also intercepted twice and lost a fumble in the defeat.