It was a no-brainer.

The Mets allow Ike Davis to take at-bats every day, so what could be the harm in letting Matt Harvey hit in the seventh inning yesterday with two outs and the go-ahead run at second base?

“That was awesome,” Harvey said after his RBI single pushed the Mets to their second straight victory, 3-2 over the Cubs at Wrigley Field. “We had been fighting to do that for a while, so that was huge for me and obviously I was able to drive in that run.”

Even if Harvey failed to deliver, the tradeoff would have seemed worth it to manager Terry Collins, who had watched the stud right-hander retire 11 straight batters to that point after scuffling early.

“It was easy,” Collins said. “I said, ‘I’ve got to let him get us deeper in the game,’ and fortunately he came through with a big hit for us. He can swing the bat, but we had already made up our mind he was going to go out there the next inning.”

Harvey (5-0) lasted 7 1/3 innings in which he allowed two earned runs on five hits with six strikeouts and no walks, but there was more late-inning drama after his departure.

Marlon Byrd, in his return after spending two-plus seasons with the Cubs, nailed Darwin Barney at the plate in the eighth as he attempted to score from second with the tying run on David DeJesus’ single.

Then, in the ninth, Anthony Rizzo hit a shot to right against Bobby Parnell that sounded like a homer, until the ball got caught in the wind and died in Byrd’s glove.

So after snapping a six-game losing streak Thursday in St. Louis, the Mets (16-23) have consecutive victories for the first time since May 3. A win today or tomorrow would give them their first series victory in nearly a month.

“We’ve had a tough couple of weeks,” Byrd said. “Yeah, we’re going to have our offensive struggles, but if we get pitching and timely hitting along with the defense, that’s how you win games. And we put it all together today.”

It certainly didn’t hurt the Mets’ chances to have sent their two best starters, Jon Niese and Harvey, to the mound on consecutive days. Today’s scheduled starter, Jeremy Hefner, is less predictable.