Mahaffey was signed as an amateur free agent by the Philadelphia Phillies on June 29, 1956, out of Western Hills High School (Cincinnati, Ohio). He began his Minor League Baseball career that summer.[1] After 41⁄2 seasons playing in the Phillies' farm system, he received his MLB call-up, playing in his first Phillies game on July 30, 1960; Mahaffey pitched the final two innings of a game against the St. Louis Cardinals. He retired the three batters he faced in the eighth inning. In the ninth, Bill White led off with a single to right field and then was picked off by Mahaffey at first base. The next batter, Curt Flood, singled to center field, and he, too, was picked off by Mahaffey, who threw to first with Flood tagged out on a throw from first to second.[2][3] He finished the 1960 season with a 7–3 record, an ERA of 2.31, 14 games played, while finishing third in the 1960 National League (NL) Rookie of the Year balloting (which was won by Frank Howard of the Los Angeles Dodgers).[1]
Mahaffey set a club record with 17 strikeouts in a game against the Chicago Cubs on April 23, 1961.[3] Though he ended the 1961 season with an ERA of 4.10, and a record of 11–19 (leading the NL in losses), in 36 games, he was selected to represent the Phillies on the NL All-Star team. Mahaffey ended the 1962 season with a record of 19–14, and a 3.94 ERA, with a career high 177 strikeouts, in 41 games. He was selected again in 1962 for the NL All-Star team, finishing 26th in balloting for NL Most Valuable Player (MVP), despite leading the league in home runs allowed with 36, and earned runs allowed with 120. Mahaffey had a 7–10 record in 26 games with the 1963 Phillies, to go along with a 3.99 ERA. In 1964, he finished the season with a record of 12–9, with an ERA of 4.52, in 34 games.[1] The ill-fated 1964 team was in first place in the NL, with a 61⁄2-game lead, with just 12 games remaining in the season, before starting a 10-game losing streak that cost the team the pennant. Mahaffey pitched in two of the games in that infamous skid, losing a 1–0 game (the first of that losing streak) on a steal of home by Chico Ruiz of the Cincinnati Reds, and was taken out while winning 4-3 in a game against the Milwaukee Braves, in which Rico Carty hit a ninth-inning bases-loadedtriple, plating all 3 runners, off of reliever Bobby Shantz, to win the game for the Braves, 6-4.[3]1965 was his last season in Philadelphia, which saw him finish with a 2–5 record, and an ERA of 6.21, in 22 games, mostly in relief.[1]
Mahaffey was traded by the Phillies on October 27, 1965, along with catcherPat Corrales, and outfielderAlex Johnson, to the Cardinals, in exchange for shortstopDick Groat, catcher Bob Uecker, and first baseman Bill White. In his only season with the Cards, he had a 1–4 record, in 12 games, with an ERA of 6.43.[1] Mahaffey was the starting pitcher in his final big league game, on July 17, 1966, in the second game of a doubleheader against the Chicago Cubs; that day, he gave up three hits, and three runs, in 1⁄3 of an inning, in a game the Cubs won by a score of 7–2.[1][4]
On April 23, 1961, struck out 17 Chicago Cubs to set a Phillies team record. He also tied the since-broken National League record for most strikeouts in a day game.
In 1962, Mahaffey became the last pitcher to strike out at least 12 batters and hit a grand slam in a game.