SAN FRANCISCO -- Two teams tail-spinning into dangerous territory in the National League playoff picture look to turn things around while adding to the other's misery when the New York Mets and San Francisco Giants open a four-game series Thursday night.

The pitching matchup in the opener has an October feel to it: Jacob deGrom vs. Madison Bumgarner. But truth be told, neither New York nor San Francisco figures to be playing much fall baseball the way their summers have been going.

The Mets (60-60) arrive in San Francisco having lost two of three at Arizona to open a 10-game trip.

More from FoxSports

And now comes the tough part: four at San Francisco (66-54) and three at St. Louis (64-56), two of the four teams the Mets are chasing in the wild-card race.

The race has gone more backward than forward for both the Mets and the Giants in recent weeks.

Having lost seven of 10 against the Diamondbacks and San Diego Padres -- the bottom two teams in the NL West -- the Mets are just 13-18 since the All-Star break, the fourth-worst record in the NL.

They are hoping deGrom (7-5, 2.30 ERA) can help get things headed back in the right direction.

The right-hander has been terrific in his past nine starts. If you throw out his only loss in that stretch -- when he was roughed up for five runs in 3 2/3 innings at Miami on July 23 -- he has allowed just five runs in 56 2/3 innings, an 0.79 ERA.

However, he has only four wins to show for those games, an indication of just how bad the Mets have been of late.

They are planning to have shortstop Asdrubal Cabrera (Thursday) and Yoenis Cespedes (Friday) back for the San Francisco series, which might help. Cabrera has been sidelined since Aug. 1 with a strained left patellar tendon, while Cespedes has placed out since Aug. 4 due to a strained right quadriceps.

San Francisco, meanwhile, fell to the Pittsburgh Pirates 6-5 on Wednesday, capping a three-game series sweep. The Giants have lost five of six on their current 10-game homestand.

They have been even worse than the Mets since the All-Star break, going 9-21, the worst record in baseball.

Along the way, the Giants have dropped out of first place in the NL West after holding the top spot for 93 consecutive days. They will begin play Thursday trailing the Los Angeles Dodgers by 1 1/2 games in the division.

"We're taking some blows right now," Giants manager Bruce Bochy said after the Wednesday loss. "But it's a tough club. It's a resilient club. They came out and did some good things (Wednesday). We're creating some good chances and opportunities."

The Giants will begin the series with their ace on the mound. Bumgarner (11-7, 2.11 ERA) has never lost to the Mets in his career, having gone 4-0 with a 1.03 ERA in five starts.

In fact, Bumgarner hasn't even allowed a run to the Mets since Sept. 13, 2013. He is the only pitcher with at least two starts against the Mets not to have given up a run against them over the past three seasons.

Interestingly, both the Mets and Giants already are planning ahead for a big series next week, when New York visits St. Louis and San Francisco goes to Dodger Stadium.

Both managers are of the same mindset with a day off Monday. Each indicated Wednesday he is considering skipping his fifth starter (the Mets' Jonathon Niese and Giants' Matt Cain) so that deGrom and Bumgarner can begin that series as well.

"We'll have to see what happens (Thursday) night," Mets manager Terry Collins said of deGrom's pitch count.