Addison Russell, left, rounds the bases after hitting a solo home run in the ninth inning for the Cubs. (Patrick Semansky/Associated Press)

With his team just four games out of a wild-card spot and one of his big sluggers returning from the disabled list, Baltimore Orioles Manager Buck Showalter preached optimism about his team’s chances as it began a 10-game homestand with a series against the World Series champion Chicago Cubs.

That shiny outlook lasted just one inning into the season’s second half, with one of the Orioles’ biggest problems — their starting pitching staff — continuing its first-half form.

In a 9-8 loss to the Cubs that began after a 49-minute rain delay Friday, Orioles right-hander Kevin Gausman gave up eight runs — including four in the first inning — seven hits and four home runs in three innings.

“I kept waiting for him [Gausman] to get on the horse a little bit but he never got it on, it was tough,” Showalter said after the loss. “Another good team. Didn’t locate his fastball enough to get some things working for him. I kept waiting for him to get a stride there, but he never did.”

The Orioles’ starters had an ERA of 5.75 heading into the game, worst in the AL and second worst in the major leagues.

With Chris Davis back in the lineup for the first time since June 12 because of a strained oblique, Baltimore managed to tie the game in the eighth, only to have Addison Russell hit a home run off right-hander Brad Brach in the ninth for the winning run.

The Orioles’ bullpen had thrown five scoreless innings to allow Baltimore to make up the eight-run deficit before Russell’s blast.

“You gotta keep grinding, especially when you got talent like us,” Showalter said. “It puts you on your heels a little bit, I don’t care how good you are, especially at this level. It really tests you mentally. It really does.”

In the comeback, Baltimore’s hitters showed some of the life they lacked in the first half of the season. Welington Castillo homered to lead off the third to put the Orioles on the board. Davis added another run in the fourth, bringing home Mark Trumbo on a double. And in the fifth, Baltimore knocked out Cubs left-hander Mike Montgomery as part of a four-run inning, which left fielder Joey Rickard capped with a two-run, bases-loaded single that cut the deficit to 8-6.

The Orioles (42-47) then tied the game at 8 in the eighth on Trumbo’s two-run home run off Cubs reliever Koji Uehara, who eventually earned the win. Trumbo finished 2 for 3 with three RBI.

“We did everything we could for it to go our way, but they just did a little bit better,” Trumbo said.

Major league teams were only 1-185 this season when trailing by eight runs at any point.

Johnny Giavotella struck out looking to end the game.

The Cubs (44-45), who made their first visit to Baltimore since 2003, quickly took advantage of Gausman, whose ERA rose to 6.39. Gausman said it was frustrating to get the second half start that he did, and called it an overall bad execution as he threw too many pitches in the zone where the Cubs took advantage.

“Kind of became a two-pitch pitcher out there and when you are a starter trying to do that, some days you can get away with it, most days you can’t,” Gausman said. “It’s just bad execution.”

In the first inning, Willson Contreras blasted a three-run homer, and Kyle Schwarber followed with a shot of his own. Ben Zobrist added a two-run homer in the second inning, and Jason Heyward hit a solo blast in the third.

Gausman left after the third inning to a barrage of boos from the frustrated crowd. But Richard Bleier, Darren O’Day, Mychal Givens and Zach Britton kept the Cubs off the board through the eighth, allowing

Baltimore to come back. Showalter singled out Britton as a reliever who has stood out over his past couple appearances, but praised the bullpen as a whole for their efforts.

“It takes a lot for you to get there and it’s tough to get over the hump, hopefully to be able to get one more shut down inning, but that’s asking a lot of the bullpen, it really is,” Showalter said.

A year ago, the Orioles were 51-36 at the break, two games ahead of the Blue Jays and the Red Sox in the American League East. It’s a different story this season after an injury-plagued first half.

And while Friday’s game ultimately is just one of 162, it is a reminder of the significance of the homestand moving forward. Specifically, these 10 games could decide whether the Orioles are buyers or sellers as the July 31 non-waiver trade deadline approaches.

“They know when the trade deadline is,” Showalter said before the game. “It is a very false deadline — you know that — but it’s not false from the standpoint of being able to play in the playoffs.”

The homestand includes two more games against the Cubs, a four-game series against the Texas Rangers and a three-game series against the AL-leading Houston Astros. All are chances for the Orioles to keep the season alive.