But the Mets were willing to cut some slack to their fireballing phenom Wednesday night and helped him avoid his first loss in dramatic fashion.

After tying it with two outs in the bottom of the ninth, Jordany Valdespin let the Mets forget about a night’s worth of offensive shortcomings by hitting a walk-off grand slam against Josh Wall in the 10th inning for a 7-3 victory over the Dodgers at Citi Field.

John Buck smacked a leadoff single in the 10th before Ike Davis walked and Marlon Byrd moved the runners with a sacrifice bunt. Lucas Duda was intentionally walked before Valdespin — against a defensive alignment that featured only two outfielders and an extra infielder playing between first and second base — cleared the right-field fence.

Kevin McReynolds had been the last Mets player to hit a walk-off grand slam, on June 25, 1991, against the Expos.

Harvey had his fastball hopping, as has become the norm, but the difference between a win and no-decision was a well-placed Matt Kemp shot in the sixth inning. Kemp’s replay-aided two-run homer put the Mets in a 3-1 hole and all but ended Harvey’s night.

In the ninth, with the Mets trailing 3-2, David Wright delivered an RBI single against Brandon League with two outs after Mike Baxter had led off the inning with a pinch-hit double and reached third on Ruben Tejada’s sacrifice. The Mets were close to sunk when Jerry Hairston Jr. reached over the third-base railing to make a lunging catch on Daniel Murphy’s pop up for the second out, but Wright came to the rescue.

Kemp hit a slicing shot to the right-field corner in the sixth that was originally ruled in play for an RBI triple, but umpires convened for a replay review lasting 2:29 that showed the ball hitting a security guard behind the fence and caroming onto the field.

The blast placed Harvey into a 3-1 hole, from which the Mets didn’t recover until Wright’s game-tying single in the ninth. Harvey allowed three earned runs on four hits and one walk with seven strikeouts over six innings.

Harvey was cruising in a 1-1 tie in the sixth, when he walked Adrian Gonzalez with two outs. Kemp’s ensuing homer was his first this season and only the second allowed by Harvey in 35 innings.

Harvey was attempting to become the first pitcher since Fernando Valenzuela in 1981 to win his first five starts in a season while pitching at least seven innings and allowing one run or fewer in each.

But Kemp’s home run ended that bid and Harvey was removed for a pinch-hitter in the bottom of the sixth.

Justin Turner’s sacrifice fly pulled the Mets within 3-2 in the sixth after reliever J.P. Howell walked Byrd and Duda in succession to begin the inning.

Ted Lilly, in his season debut, frustrated the Mets with his assortment of off-speed pitches, allowing one run on six hits and two walks over five innings with seven strikeouts. The lefty made only eight starts last season before undergoing surgery to repair a torn labrum in his shoulder.

Tejada’s RBI single in the fifth made it 1-1, but the Mets missed an opportunity to add on as Lilly struck out Wright and Davis — with a Buck fielder’s choice sandwiched in between — to leave two runners on base. Harvey’s double off the left-field fence preceded Tejada’s dribbler to right field that got the Mets on the board.

Mark Ellis, who torched the Mets for two homers and four RBIs in the Dodgers’ 7-2 victory on Tuesday, singled to begin a rally in the first inning. After Gonzalez followed with a single, Kemp hit into an RBI fielder’s choice, giving the Dodgers a 1-0 lead.

Wright walked and stole second in the third inning, but was left stranded when Buck struck out. An inning earlier, the Mets loaded the bases with two outs against Lilly before Harvey was retired.