KANSAS CITY, Mo. -- Zack Greinke threw 109 pitches in holding the Kansas Royals scoreless for 8 1/3 innings.
Frieri (3-1) replaced Greinke with one out in the ninth after Alex Gordon singled. Butler homered to center on Frieri's first pitch to tie it. Three pitches later, Perez hit a flyball off the left-field pole for his first career walkoff homer.
"This ballpark can play funny sometimes," Butler said. "I knew that one was gone. We knew we were looking for a fastball. I told Sal on deck, `You'd better not be late' and neither of us was late."
All Greinke could do was watch the dramatic turn of events.
"It was pretty amazing," Greinke said. "I don't think I've ever seen back-to-back homers to walk off like that. I don't know if it's ever happened. You don't see that I think ever.
"It's part of baseball," Greinke added. "Ernie's got a great fastball. Butler is a good fastball hitter. Yesterday he got it by them. He threw his best pitch to both of those guys and it just didn't work out."
Greinke gave up just five singles, walked two and struck out three in 8 1/3 innings. He has allowed seven runs and 24 hits in 37 innings for a 1.70 ERA in his past five starts.
Greinke, who has thrown up to 118 pitches in a game this year and at least 103 pitches in all 10 of his Angels starts, said he could have finished.
"Yeah, but I mean I'm not going to second guess," Greinke said. "I think he's (Mike Scioscia) probably the best manager in baseball at least from the outside looking in and so far being here. He's smarter than me."
Greinke has not pitched a complete game since 2009 when he won the American League Cy Young Award while with the Royals.
"We were getting to that point where I wanted to give them a different look," Angels manager Mike Scioscia said on pulling Greinke. "Obviously it didn't work. Zack was getting near 110 pitches. Ernie just hit a couple of bats with fastballs. He left them up, middle in and those guys didn't miss them."
The Angels entered the day 2½ games back of Baltimore and New York for the second wild-card spot in the AL
"Anytime you lose a game late it's a heavier page to turn, but we have to come out tomorrow," Scioscia said. "We're at the point in the season where everything changes, inning to inning, pitch to pitch."
Guthrie, who was 4-0 with a 1.70 ERA in his previous seven starts, faced the minimum number of batters the first four innings. He gave up a fourth inning leadoff single to Mike Trout, but picked him off first. Guthrie left after eight innings, allowing two runs on five hits.
"I thought early my fastball was good," Guthrie said. "I left a fastball up to Morales, but I got some groundballs and we played good defense. The majority of your games are against tough lineups. When you go up against that you anticipate a dog fight."
Kelvin Herrera (3-3) replaced Guthrie and picked up the win with a scoreless ninth.
Greinke, who was acquired from Milwaukee in a trade on July 27 trade, pitched out of a first inning jam.
Alcides Escobar, who had two of the hits off Greinke, singled with one out to extend his hitting streak to a career-high 11 games. Escobar advanced to third on Gordon's groundball single to right.
Escobar was out at the plate when he attempted to score on Butler's grounder to third baseman Alberto Callaspo. Perez's grounder to Callaspo ended the inning and threat.
The Angels added a run in the eighth, when Vernon Wells led off with a single and advanced to third on two groundball outs. After Trout walked, Torii Hunter laced a run-scoring single to right that Francoeur apparently lost in the lights as it glanced off the heel of his glove. Hunter leads the American League with a .349 average since the All-Star break and has 16 RBIs in his past 17 games.
RHP Ervin Santana might be pushed back a few days in the Angels rotation after being struck in the arm by Josh Donaldson's liner in Wednesday's start against Oakland. "Ervin just got smoked on the forearm," Scioscia said. "We might take a couple of days with him. Ervin's going to get the ball; he's going to pitch. It's set him back a little bit as to when he's going to throw his `pen. He'll throw a couple of light things. He'll probably throw this weekend and then we'll see where he is." . Royals 2B Johnny Giavotella committed two errors. The Royals had committed just five errors in their previous 18 games. .This series closes Sunday with the Royals starting rookie LHP Will Smith, who pitched seven scoreless innings Tuesday in a victory at Minnesota. RHP Dan Haren will start for the Angels.