New York: When Matt Harvey slapped his hand into his glove as he strode off the mound after finishing his eighth scoreless inning, the Mets and Cardinals had barely played for two hours.

Six innings later, he was just happy to see John Mayberry Jr. come through in the clutch.

Pinch hitting with one out in the bottom of the 14th, Mayberry grounded an RBI infield single, lifting the Mets to a 2-1 victory over St. Louis on Monday night after blowing another lead for Harvey.

“At one point I looked at the clock and it had been two hours since I pitched. Usually that means you gave up a lot of runs in the first innings and you had to watch the whole game.” Harvey said after the 4-hour, 14-minute marathon. “Coming out with the win was huge for us.”

Lucas Duda beat a shifted, drawn-in infield with an opposite field hit for a run-scoring single off John Lackey in the fourth, but Jason Heyward had a sacrifice fly in the ninth off closer Jeurys Familia as the Mets wasted a second consecutive 1-0 lead for their ace.

The division leaders then struck out a combined 12 times in extras before Sam Tuivailala (0-1) walked Eric Campbell and Duda to open the 14th. Cardinals closer Trevor Rosenthal relived and got Michael Cuddyer to ground into a fielder’s choice. Rosenthal then intentionally walked Daniel Murphy to load the bases.

Mayberry, who entered batting .114, grounded the first pitch to diving drawn-in shortstop Jhonny Peralta, who got his glove on the ball. Campbell slid home ahead of a late throw that stretching catcher Yadier Molina could not reach.

“Sometimes it’s good to have luck on your side,” Mayberry said. “Anyway you can get it done.”

Carlos Torres (2-2) pitched two innings for the NL East-leaders’ third straight win after a five-game skid. The Mets were the last major league team to play extra innings this season.

Heyward doubled with one out in the 14th but reliever Seth Maness had to bat because St. Louis was out of position players. The Central-leading Cardinals didn’t get into New York until after 3am following their Sunday night game in St. Louis, a 2-1 win.

The Cardinals went 0 for 11 with runners in scoring position.

It was the third consecutive start in which New York gave Harvey one run of support. This time, Harvey outpitched Lackey in a taught duel before giving way to Familia in the ninth.

“Two terrific pitching performances,” Cardinals manager Mike Matheny said. “John Lackey was good as any pitcher can be and, unfortunately, we couldn’t get anything going offensively.”

Familia gave up one out singles to Matt Adams and Molina. Heyward then hit a 245 foot flyball to right field, but Curtis Granderson’s throw was several feet up the third base line and pinch-runner Pete Kozma easily slid home safely. It was Familia’s first blown save in 14 chances.

“He got a split up. You can’t throw a strike,” manager Terry Collins said. “You’ve got a guy 0-2, the one thing you can’t do is leave a ball on the plate.”

Harvey gave up six hits and matched a season-high with nine strikeouts in running his scoreless innings streak to 16 and lowering his ERA to 1.98 from 2.31.

Lackey, at 36, more crafty than his overpowering opponent who is 10 years his junior, was every bit as good. Facing the Mets for just the third time and first since 2008, when he was with the Angels, Lackey stifled New York for seven efficient innings, allowing three hits and a run.

He held the Mets hitless until Granderson doubled leading off the fourth.