Carlos Beltran's RBI single in the eighth produced a 5-5 tie and the Mets won the game in walk-off fashion in the ninth.
Davis led off the ninth with a single off Will Ohman (0-2) and went to second on Josh Thole's single. One out later, Castillo looped a hit to shallow right, plating Davis with the game-winner and handing the Mets a victory in the first of a three-game series against Florida.
The rally made a winner of Hisanori Takahashi (8-6), who had tossed a scoreless top of the ninth.
Angel Pagan went 4-for-5 with three runs scored and Beltran finished with two hits and a pair of RBI for New York.
Gaby Sanchez drove in four runs -- three of them on a seventh-inning homer -- and Hanley Ramirez went 3-for-5 for Florida.
Copyright 2010 United Press International, Inc. (UPI).