NEW YORK – Javier Vazquez made his first relief appearance in four years. Marcus Thames got the third game-ending hit of his career.

Only Alex Rodriguez was used to this sort of late-inning madness.

“We did it the hard way today,” Rodriguez said.

Rodriguez hit a tying homer off Jonathan Papelbon in the ninth inning and Thames connected moments later for a two-run shot of his own, giving the New York Yankees a wild 11-9 victory over the Boston Red Sox on Monday night.

With one out and a runner on third, Rodriguez hit the first pitch into the visitors’ bullpen in left-center to tie it at 9. Papelbon (1-3) got Robinson Cano to fly out but hit Francisco Cervelli with a pitch before Thames drove his next delivery over the wall in left.

“I knew I had that one,” Thames said. “I’ve hit a few and that one felt pretty good.”

Thames was mobbed at home plate after New York’s first game-ending hit of the season. He also got the customary cream pie in the face from pitcher A.J. Burnett, part of the routine when the Yankees had 15 game-ending hits last year.

“I think that’s the feeling we had all last year,” Rodriguez said. “We’re at home. Until the last out is collected we think we’re going to win.”

Vazquez (2-4) got a most unlikely victory, striking out Kevin Youkilis with runners on the corners for the final out of the ninth. Yankees Manager Joe Girardi only went to the struggling starter for his third career relief appearance because his depleted bullpen was without David Robertson and Joba Chamberlain.

“I really don’t know what I’m doing out there as a reliever,” said Vazquez, who last came out of the bullpen on July 9, 2006, for the Chicago White Sox against Boston. “I just tried to make good pitches against him.”

The Red Sox hit five homers but still lost their eighth consecutive game at Yankee Stadium, their longest road skid against New York since dropping eight straight from 1960-61. Victor Martinez connected from both sides of the plate, and David Ortiz, J.D. Drew and Youkilis also went deep.

“It’s not what you’re looking for, but it happens,” Ortiz said. “We’ll come back and play tomorrow; there’s nothing else you can do.”

It was Papelbon’s first blown save in the regular season since July 28, snapping a streak of 22 straight conversions. The only other time he allowed two homers in a game was to Minnesota’s Justin Morneau and Jacque Jones in his major league debut on July 31, 2005, according to STATS LLC.

“Flat fastballs, poorly executed pitches on my behalf,” he said. “Usually in those situations bad things happen.”

Rodriguez also had a two-run single off Daisuke Matsuzaka in New York’s five-run first, its biggest opening inning of the season. Cano had an RBI single and Cervelli doubled in a run, improving to 11 for 14 with runners in scoring position.

But it wasn’t enough as Phil Hughes struggled for the first time this season and New York’s makeshift bullpen couldn’t hold on after Hughes departed with a 7-5 lead following five sluggish innings.

Boston roughed up relievers Boone Logan and Chan Ho Park.

Youkilis connected for a go-ahead, two-run homer against Park in the eighth. Martinez then hit a long drive that cleared the Yankees’ bullpen in right-center, giving Boston a 9-7 lead.