NEW YORK (AP) -- Yankees manager Joe Girardi sat in the dugout discussing whether to bring in a pinch-runner for Jason Giambi, confident that the sore-footed slugger could reach base with two outs in the ninth inning and New York trailing by one.
"I was prepared for his getting on base," Girardi said. "I wasn't prepared for him to hit it into the upper deck."
Giambi's pinch-hit, two-run homer on an 0-2 pitch from B.J. Ryan capped the Yankees' biggest comeback this season. They rallied from a five-run deficit Thursday for a 9-8 victory over the Toronto Blue Jays.
Giambi has missed two straight starts since being hit on the top of his left foot by a pitch Tuesday.
"That's the great thing about baseball," Giambi said. "You can go from zero to hero real quick."
Ryan (1-2) blew his second consecutive save chance after starting the season 12-for-12. He had a two-run lead and two outs before allowing three straight hits, the last Giambi's drive just inside the right-field foul pole.
"A terrible pitch at a terrible time," Ryan said.
It was Giambi's second career pinch-hit homer and the fourth game-ending shot of his career. With one swing, he helped New York overcome another poor outing by Chien-Ming Wang and a key error by center fielder Melky Cabrera.
The Yankees (30-30) took two of three in the series and got more good news with the return of catcher Jorge Posada. He went 1-for-3 in his first start since coming off the disabled list.
Matt Stairs homered to snap an 0-for-12 drought and had five RBIs for the Blue Jays, who led 7-2 after a five-run fifth. The Yankees chipped away with two runs in the bottom half and two more in the sixth to pull to 7-6 before Stairs' RBI double in the ninth.
Kyle Farnsworth (1-2) earned the win despite allowing that run, but wriggled out of a bases-loaded jam to keep the deficit at 8-6. Cabrera earned some redemption with a running catch to end the inning.
"When Scott cut in front of me, I sort of lost it," Eckstein said. "I don't know if I could have thrown him out, anyway."
Rodriguez moved to second on defensive indifference and scored on Hideki Matsui's single. That brought up Giambi, who batted for Jose Molina. About a half-hour before the game, Giambi told Girardi after taking batting practice that he was available to hit.
Ryan got ahead of Giambi with two sliders.
"The first two were really good," Giambi said. "I was kind of looking fastball. But he threw me another one, and it just didn't do as much as the first two."
The only question was whether the ball was fair or foul.
"I had my doubts at the beginning," Giambi said, "but then it straightened out."
Blue Jays right fielder Brad Wilkerson, who came on as a defensive replacement in the seventh, made what at the time appeared to be a game-saving catch to end the eighth.
The Yankees had the potential tying and go-ahead runs on with two outs when Johnny Damon hit a deep drive toward right-center. Wilkerson jumped to snare the ball before crashing into the wall.
Cabrera's defense wasn't as sterling in the fifth. With two on and one out, he dropped Alex Rios' liner, allowing the go-ahead run to score.
Wang allowed at least five runs for the fourth straight start as his recent wildness persisted. The right-hander gave up seven runs, six earned, on five hits and four walks in 4 1/3 innings.
Posada said Wang struggled with finding a consistent arm angle.
Posada, who had been out since April 28 with right rotator cuff tendinitis, singled on the first pitch he saw in the second inning.
Then Giambi came back from his own injury to homer on the last pitch he saw.
"It sure made a tough day into a great day," Damon said.
Wang has walked at least three batters in six straight starts. ... Damon extended his hitting streak to 14 games with a third-inning single. ... Blue Jays CF Vernon Wells (broken left wrist) was scheduled to begin his rehab assignment at Class-A Dunedin on Thursday night. ... Blue Jays C Rod Barajas was back in the lineup after leaving Wednesday's game with tightness in his lower back. ... Matsui struck out to end the third for his first strikeout in 59 plate appearances, the longest streak of his career, according to the Elias Sports Bureau. ... Rios singled leading off the ninth to extend his hitting streak against the Yankees to 26 games. That ties for the longest current streak in the majors for a player against one team, according to Elias. Seattle's Ichiro Suzuki has hit in 26 straight against Kansas City. It's the longest hitting streak against the Yankees since Detroit's Charlie Gehringer had a 31-gamer from 1935-36. ... Wilson Betemit homered for the second straight day while starting at first in place of Giambi.