The Lions had grabbed a 16-15 lead with 2:27 remaining in the fourth quarter on Matthew Stafford's 14-yard touchdown pass to Joseph Fauria.
But Joe Flacco, who had injured his knee on the previous series, got the ball back and led the Ravens 24 yards on seven plays, setting up Tucker's go-ahead kick -- the longest in franchise history.
Matt Elam then sealed the win with an interception as defending Super Bowl champion Baltimore (8-6) grabbed control of the second AFC wild card spot and pulled one game behind AFC North-leading Cincinnati.
Tucker also connected on kicks of 29, 24, 32, 49 and 53 yards to provide all of Baltimore's scoring.
Flacco completed 20-of-38 passes for 222 yards without an interception and Jacoby Jones made six catches for 80 yards.
Stafford was picked off three times overall for Detroit (7-7), which fell into third place in the NFC North, one game behind division-leading Chicago. He completed 18-of-34 passes for 235 yards with a TD.
Calvin Johnson had six receptions en route to 98 yards for the Lions.
Duggar sisters unveil Christian dating rules in new book
McPhee, Cokas 'working on their marriage' after affair