Robinson Cano had a two-run single and New York, still missing injured sluggers Alex Rodriguez and Nick Swisher, overcame a shaky return to the rotation for Javier Vazquez, who was yanked in the fifth.
With the best record in baseball but only a slim lead in the AL East over Tampa Bay, the Yankees won for the 14th time in 18 games and improved to 6-0 on their 10-game homestand.
Jason Frasor (3-4) retired his first two batters in the seventh before Cano singled. Thames drove an 0-1 pitch to the back of the Blue Jays' bullpen in left-center for his 11th home run, snapping a 1-for-14 skid.
It was the latest clutch homer for Thames, a part-time player who hit six long balls in a span of five starts that ended with Monday night's victory over Oakland.
Lyle Overbay homered and drove in three runs for the Blue Jays in his second game back after missing five with post-concussion symptoms. John McDonald also went deep, increasing Toronto's total to a major league-best 205 homers.
Jose Bautista, who leads the big leagues with 43, was ejected by plate umpire Ed Hickox for arguing a called third strike on a full-count pitch with two on and none out in the seventh. Bautista barked about all three breaking balls from Joba Chamberlain that were called strikes. On the third one, the slugger snapped into an animated protest and was tossed.
Chamberlain (2-4) then induced a double-play grounder from Vernon Wells and wound up with his first win since May 14 against Minnesota.
His velocity down, Vazquez was demoted to the bullpen last month following five straight winless starts. He had two solid outings in long relief, including a win Monday night, and was handed the ball Saturday for his first start since Aug. 21.
The right-hander was effective at times, striking out six in 4 2-3 innings, with a fastball in the upper 80s (mph) and a good breaking ball. But he walked four and gave up two home runs — both in the second inning.
Overbay hit a solo shot to right and McDonald snuck a two-run drive into the left-field corner, just over the 318-foot sign.
New York responded in the third. Derek Jeter grounded an RBI double over third base, ending a 3-for-35 slide, and Cano hit a two-run single off starter Mark Rzepczynski.
Brett Gardner had an RBI groundout in the fourth and another run scored on Rzepczynski's wild pitch.
For the second consecutive day, Yankees manager Joe Girardi pulled a starter who led 5-3 in the fifth and was one out shy of qualifying for a win. In both cases, Overbay was coming up with two runners on.
In the series opener, left-hander Boone Logan struck out Overbay and the Yankees went on to win. This time, Overbay lined a two-run double into the right-field corner off right-hander Dustin Moseley to tie the score 5-all.
Moseley was warming up after a leadoff walk in the third, but Vazquez struck out Bautista and Wells to get out of the inning.
NOTES: Blue Jays manager Cito Gaston held a brief meeting two hours before the game and said he simply reminded his team to keep hustling and finish the season strong. "If we can finish over .500, it'd be great," Gaston said. ... Toronto SS Yunel Escobar (stiff back) missed his sixth consecutive game. ... Gaston said catching prospect J.P. Arencibia won't play much down the stretch because he wants to stick with All-Star C John Buck, a team leader. ... Yankees 1B Mark Teixeira was shaken up after getting hit by a pitch just above the left elbow in the fourth. He was checked by Girardi and a trainer, but stayed in game. ... Rodriguez, eligible to come off the disabled list Sunday, hung out with New York Jets LB Jason Taylor before the game. "I liked him a lot when he was a Dolphin. He's my boy," said Rodriguez, who grew up in Miami and lives there in the offseason.