"It's every player's dream to come and get a chance in a big situation like that, and get to the plate and do the job the way I did today," Miranda said.
After Mariano Rivera blew a save for the fifth time this season and third time this month, the Yankees were two outs away from what could have been a deflating three-game sweep. But in what several players called their biggest win of the year, New York toppled closer Jonathan Papelbon to keep the game going before walking off against Okajima in the 10th.
"There's no question this was a huge game," said Alex Rodriguez, who launched a two-run homer off Daisuke Matsuzaka in the seventh and worked a key walk in the ninth. "This was an enormous game for us, especially because it was our last home game for a bit now, and I think it would have been devastating to lose a game at home like that."
Robinson Cano logged a bases-loaded single off Papelbon in the ninth, marking the closer's eighth blown save of the year and setting up Joba Chamberlain and Boone Logan to keep Boston quiet in its half of the 10th.
Okajima relieved and loaded the bases on a Curtis Granderson hit, a Brett Gardner bunt single and an intentional walk to Derek Jeter. One out later, Miranda dodged a 3-1 pitch that forced home the game-winning run.
"When you are on the verge of getting a win like that," Red Sox manager Terry Francona said, "to not do so hurts."
But the Yankees -- already smarting from a four-game slide that has dented their chase of winning the American League East -- needed it as well, and Rivera's rocky ninth made the outlook appear bleak.
"The game is definitely important," Rivera said. "To me, all of the games are important. Giving up the lead is not acceptable. But you have to continue to battle to the end and play hard. That's what we do every day."
Bill Hall and Mike Lowell drove in runs to give Boston a 3-2 lead with three outs to go. Ryan Kalish stroked a one-out single to center field and stole both second and third bases, coming home on Hall's game-tying single past A-Rod at third base.
With Rivera struggling to hold runners, Hall followed Kalish's example and stole both second and third on the All-Star closer, scoring the go-ahead run for Boston on Lowell's pinch-hit sacrifice fly.
"All of a sudden, there are guys on base, running all over the place -- it happened so fast," Rivera said.
The ninth-inning rally erased a lead crafted by A-Rod's two-run homer off Matsuzaka in the seventh inning, Rodriguez's 29th of the year.
Rodriguez pumped his right fist in the air and clapped his white batting gloves repeatedly. It was the first solid strike against Matsuzaka, who limited New York to two singles over his first six scoreless innings.
"I've never seen Matsuzaka throw the ball as well as he threw it tonight -- he was pretty incredible," A-Rod said. "Tonight, he was as good as I've seen him since he came here from Japan. He made one mistake."
Phil Hughes -- sent to the mound instead of scheduled starter Dustin Moseley despite only 24 hours' notice -- nearly matched Matsuzaka in the early going.
Informed late Saturday that he should get ready to face the Red Sox, Hughes delivered about as strong a performance as the Yankees could have hoped for.
"It was fine," Hughes said. "I really didn't need a lot of preparation going in. It's just nice to come to the ballpark and know you're starting, and I was told yesterday. It wasn't a shock."
Hughes limited the Red Sox to one run on three hits in six-plus innings, touched only by a Victor Martinez RBI single in the third inning. The right-hander struck out four and walked four, including the final two Red Sox batters he faced, but Dave Robertson bailed Hughes out of a key jam in the seventh.
"After the game [Matsuzaka] had, I didn't think I'd pitched well enough to win us this ballgame," Hughes said. "Matsuzaka was tremendous, but you kind of had a feeling we'd push across a couple of runs. We just needed to get out of that jam I put us in, and Robertson did a great job. That was a big turning point for us."
The final moment of the Yankees' regular-season home schedule was captured in Miranda's race between first and second bases, and it was impossible not to think back to the magic that marked the inaugural season at Yankee Stadium.
That year featured 15 walk-off wins -- the last of which came with Miranda at the plate on Sept. 29, 2009, against the Royals. But the Yankees definitely craved this one more, coming in home game No. 81, with one last nudge still needed to ensure that the lights will come back on in the Bronx.
"We've talked about that we still want to win our division, we still want to get home-field advantage," manager Joe Girardi said. "We're fighting like crazy to do that. But it's a much better feeling in that clubhouse tonight than it had been lately, that's for sure."