BOSTON -- A zany and thrilling rally by the Red Sox in the eighth inning led to a 4-3 victory on Thursday afternoon over the Pirates, who made a one-day return to Fenway Park after last week's series finale was postponed due to rain.

The Bucs seemed in good position to win Thursday's matinee, riding a strong pitching performance by Chad Kuhl (6 1/3 innings, 5 H, 1 ER, 0 BB, 6 K's) to a 3-1 lead with eight outs to go.

Hanley Ramirez (game-tying two-run double) and Xander Bogaerts (RBI single) put the Red Sox ahead with clutch hits against reliever Juan Nicasio in a three-run rally.

"Their starting pitcher did a great job," said Bogaerts. "He kept us off-balance. His ball was moving a lot today. He got us a lot out in front. His ball was moving, so give him a lot of credit for that. We just waited for some of the relievers to come in and did damage on them."

Strange things started happening after Dustin Pedroia 's one-out walk. Andrew Benintendi flared one into center that fell just in front of Starling Marte , who then fired to second to try to get Pedroia on an 8-4 force. But second baseman Phil Gosselin couldn't corral it, and everyone was safe on the error. Mookie Betts then walked against Nicasio, loading them up with one out.

Then, more craziness. Ramirez launched one to deep center for a double that Marte reached his glove out for but just missed. Shortstop Jordy Mercer took the relay and fired home, where two Boston players had already scored. Betts was just a few feet behind Benintendi as he tried to score. Betts, who didn't seem to have enough room for a good slide, was initially called safe as Ramirez -- literally and figuratively -- roared into third base. But after a challenge by Pirates manager Clint Hurdle, the call was overturned and Betts was out.

"I crushed that ball," said Ramirez. "That's good when you see guys running all over the place in front of you. That was an exciting moment right there, late in the game. When you come from behind, it's always exciting."

In the wake of the madness, Bogaerts reached for a low and outside pitch and calmly laced the 97.4-mph offering for a game-winning RBI single to right that scored Ramirez.

"My second strike, he threw me a fastball away, and I swung and missed," said Bogaerts. "And the last pitch, I just said, 'He probably wants to go back to that pitch, because I had no chance on that fastball.' And I tried to be more ready for it if he came with it again."

Closer Craig Kimbrel closed it out in the ninth to give the Red Sox a wild win. The Bucs packed their bags right after the game and geared up for the start of a three-game series at Wrigley Field that starts Friday afternoon.

• Hudson, Nicasio can't close door

"We weren't able to get things done in that eighth inning that we needed to and they have very good offensive club," said Pirates manager Clint Hurdle. "We've got to pitch to spots, as Chad did throughout the entire game. He was able to make pitches, change speeds, be effective. We just picked the wrong time to have a bad inning."

MOMENTS THAT MATTERED

Marte's miss creates chaotic equalizer: When Ramirez's drive in the eighth left the bat, Benintendi stayed close to second base so he could be ready to tag up and go to third if Marte had made the grab. Betts, meanwhile, was going all the way to second no matter what and would have retreated had the flyball -- which had a Catch Probability of 83 percent according to Statcast™ -- been caught. When it dropped, mayhem ensued. Dustin Pedroia scored to make it 3-2. As Benintendi crossed home with the tying run, Betts was right on his tail -- so much so that he didn't have room to make a proper slide. Even though Betts was out, it all ended well for the Red Sox, thanks to the clutch knock by Bogaerts.

"We joke about who's fastest all the time. I guess that kind of proves it," said Benintendi.

Unfortunately for the Pirates, Marte couldn't come up with the catch.

"I read the ball good, but it was a hard line drive," Marte said. "I tried to catch the ball, but it was over me. I did the best I can with the line drive." More >

Vazquez guns down Frazier: Pittsburgh's Adam Frazier tried to jump-start a game-tying rally in the top of the ninth when he led off with a single against Kimbrel. But with one out, he tested cannon-armed catcher Christian Vazquez and paid for it while trying to steal second base. Vazquez nailed him by a comfortable margin, making up for a rare misfire in the sixth, when he threw a ball into left field, allowing Gregory Polanco to steal third and score.

"And Vazqy, that's a difference-maker with him behind the plate. Just an exceptional thrower," said Red Sox manager John Farrell.

McCutchen's Monster mash: Though they would have preferred it came in a win, Andrew McCutchen hitting a two-run laser over the Green Monster in the top of the first was a good sign as the right fielder tries to have a bounce-back season. It was McCutchen's first homer of 2017.

"He gave me a good pitch," McCutchen said. "First pitch, heater. I'm assuming it was middle-middle. If you're a big leaguer, that's what you're supposed to do."

QUOTABLE

"You learn through the years and watching others. I had a chance to play with David [Ortiz], and I saw he never tried to overdo and he always stayed calm and let the ball come to him." -- Ramirez, on coming through in the clutch

"You get to go to Fenway, you get to go to Wrigley and you get to go to Busch. So it all depends on how you look at it. We're looking forward to the opportunity. We're going to play good baseball clubs in good baseball cities." -- Hurdle

SOUND SMART WITH YOUR FRIENDS

McCutchen's first-inning home run was the first ever hit by a Pirates player at Fenway Park. Pittsburgh has played only two other series in Boston; the 1903 World Series and a 2005 Interleague set. The only other Pirates home run hit in Boston, at Huntington Ave. Baseball Grounds, was by Jimmy Sebring in game one of the '03 World Series off of Cy Young and Boston Americans. It was the 176th home run of McCutchen's career, tying him for fourth on the Pirates' all-time leaderboard, alongside Barry Bonds.

WHAT'S NEXT

Pirates: The Bucs open up a three-game series vs. the Cubs on Friday at 1:20 p.m. CT. Right-hander Gerrit Cole is in search of his seventh win in eight starts at Wrigley Field, where he holds a 2.20 ERA over 45 innings. The Pirates won just one game at Wrigley last year, behind eight scoreless frames by Cole.

Red Sox: The Red Sox welcome their third team of the week to town when the Rays visit for the start of a four-game series on Friday night at 7:10 p.m. ET. Rick Porcello (1-0, 4.38 ERA) gets the start for Boston. He will be opposed by Chris Archer (1-0, 2.45 ERA).

Watch every out-of-market regular-season game live on MLB.TV.