MIAMI — The quicksand in which the Orioles have been treading lately pulled them down once more. Baltimore looked to be clear of it, breaking out on offense over the first four innings, but the downward spiral commenced in the ninth inning of Thursday’s series finale against the Marlins, and it leaves the Orioles pondering how this all has transpired.

They took a six-run lead by the fourth inning. They looked to be cruising behind right-hander Corbin Burnes.

But, when things are going poorly, the storm cloud on the periphery has a habit of sneaking up and spoiling what looked to be a routine victory. Earlier this season, these were the kinds of games Baltimore finished without issue. But on Thursday the ninth-inning collapse that included command issues from right-hander Craig Kimbrel and a costly error by shortstop Gunnar Henderson forced extra innings.

The Orioles came out with a victory, 7-6, even after all of that. But it’s emblematic of the way July has gone that Baltimore needed extra innings in a game in which it once held a healthy advantage.

The Baltimore Banner thanks its sponsors. Become one.

“I think our guys are very, very aware that we should’ve won that game handily,” manager Brandon Hyde said. “And I think some guys are individually frustrated with their performances right now, and we just have to get back to a team concept, honestly, and they know that. We’re really a good team, and it’s great we came out of here with a win. We’re .500 on the road trip. But there’s some things that we’re not doing that we need to get back to to put ourselves in a better position.”

And while the Orioles scored in the 10th, that inning wasn’t without incident, either.

With runners on second and third and one out, Ryan Mountcastle drove in the go-ahead run with a single to right field, but Jesús Sánchez threw a dart to home plate to easily nab pinch runner Cedric Mullins. And, as Mountcastle attempted to take second on the throw, catcher Ali Sánchez threw him out to end the frame.

“I think I hesitated a little bit,” Mountcastle said. “So, shouldn’t have hesitated, should have just went, but it is what it is.”

Before the game, Hyde said the Orioles “have a bunch of guys right now who are kind of grinding offensively.” He believed in the process and the work being done. He took solace in how the mental fortitude of his clubhouse hadn’t seemed to waver.

The Baltimore Banner thanks its sponsors. Become one.

But “sometimes you put some stress on yourself, some pressure on yourself,” Hyde said, “and I think we have been kind of going through that for a few weeks.”

The immediate response seemed to indicate a turnaround. The Orioles opened with six runs in quick succession, providing a cloudburst of run production that they’d hope would loosen the nerves of a lineup that developed over the course of a trying month.

Anthony Santander provided the first blow against right-hander Roddery Muñoz. Santander blasted his 28th homer of the season to right field, and the runs came in bunches after that.

“You saw the emotion when he hit that homer,” Hyde said. “He was trying to get the guys going because we’ve been stale.”

James McCann drove an RBI single with two outs in the second, and Connor Norby — making his return to the majors because of infielder Jorge Mateo’s dislocated elbow — clubbed an opposite-field homer in the fourth. For Norby, that was his second homer in five major league games, and he provided an instant spark that the offense required.

The Baltimore Banner thanks its sponsors. Become one.

But no swing was more meaningful than Cowser’s third-inning crack. He took a cutter that Muñoz left over the heart of the plate to center field for a two-out, three-run home run. Baltimore has missed those major breakthroughs of late, more often than not stranding runners rather than finding two-out success.

Cowser has done it in two games now. He rifled a bases-clearing double in a loss Wednesday with two outs, then came back for his 14th homer of the year.

Since the All-Star break, Cowser has a hit in six straight games. He’s hitting 8-for-20 over that span with nine RBIs, and his season on-base-plus-slugging percentage has risen to .767.

Behind that offensive surge was a strong display from Burnes, who completed 7 1/3 innings for the first time this season. It couldn’t have come at a better time, following two outings from starters that lasted four innings or fewer to begin the series.

Burnes has made a habit of this over his career — dominant outings have earned him a Cy Young Award — but more so than ever, he has focused on maintaining his pitch count at a reasonable level. He allowed four hits and one walk and struck out five, allowing him to finish the seventh inning at 86 pitches.

The Baltimore Banner thanks its sponsors. Become one.

“I knew coming in that I had a lot of opportunities in this lineup to throw the curveball,” said Burnes, who used that pitch 31% of the time. “When the cutter command is not there, got to rely on something, and the curveball was that pitch today. So was able to kind of keep my base with it until we kind of got the command figured out with the cutter, then we kind of rolled from there.”

He took the mound again in the eighth because of how efficient he had pitched earlier. Burnes was charged with two runs that frame after allowing two singles — and they loomed larger when Kimbrel struggled.

Baltimore has still lost more than it has won this month. The Orioles are 12-16 since June 21, and there are ample questions surrounding the pitching staff as the July 30 trade deadline nears.

The reminders of that poor play showcased themselves in the ninth inning, when Kimbrel loaded the bases with one out via a single and two walks. Then Henderson, usually sure-handed, bobbled a grounder to allow a run to score. Another run came home on a sacrifice fly, and the Marlins tied it when Josh Bell singled against Kimbrel.

Mountcastle’s single in the 10th gave Baltimore a lead, and left-hander Cionel Pérez held on to it in the bottom half to bail out a collapse.

The Baltimore Banner thanks its sponsors. Become one.

Even after all that, the Orioles are still in first place in the American League East. They’re “really fortunate,” Hyde said, that their slide coincided with those of their divisional opponents.

“We’ve gotten lucky that we’re not playing our best baseball, and neither are some of the other teams in our division,” Hyde said. “So, fortunate and unfortunate. Wish we were playing better so we could extend the lead a little bit right now.”

If this is Baltimore’s nadir, the outlook isn’t terrible. The Orioles have remained afloat — they’re tied for the American League lead with the Cleveland Guardians. But, for as solidly as Thursday began, the end sent alarm bells ringing once more.

“We know that we can play better baseball,” Burnes said. “We haven’t played our best coming out of the break. Really wasn’t playing our best going into the break. So every team has its stretches. We understand that this isn’t our best baseball. We know we can play a lot better, so we’ll see how we respond.”