The Rays took an early 2-0 lead, but twice had to come from one run down to tie the game.
Yunel Escobar hit a seventh-inning home run for Tampa Bay to make it a 4-4 contest and Tampa Bay finally won it in the 10th against a pair of Toronto relievers.
Ryan Roberts drew a walk to load the bases, bringing up Scott. Lincoln got in front of Scott 0-2, but then threw four straight pitches out of the strike zone to force in Longoria with the winning run.
That made a winner out of Kyle Farnsworth (2-0), who worked a perfect top of the 10th.
Jose Bautista drove in two of the Toronto runs with a double and sacrifice fly. Tampa Bay grabbed a 2-0 lead in the first with Longoria delivering an RBI double and then scoring on a single by Matt Joyce.
Notable deaths of 2014 [PHOTOS]