The game was delayed by rain at the start for an hour, but the Mets' bats warmed up in a hurry once it got started.
Justin Turner, however, singled in two runs and Davis then hit the first pitch from Pettitte over the wall in right.
The Mets won their fourth straight and the Yankees have lost three in a row on the heels of a 10-game winning streak.
Solo homers by Alex Rodriguez and Andruw Jones, along with a two-run blast in the eighth by Robinson Cano, brought the Yankees within two, but they came up short when Frank Francisco worked out of a ninth-inning jam for his 18th save.
Jon Niese (5-3) got the win by giving up two runs on eight hits over 6 1/3 innings.
Pettitte (3-3) lasted six frames and allowed five runs on seven hits.
2014: The Year in Music [PHOTOS]