Preller said late Wednesday that the team has been watching Pirela for some time, and that the two teams had previously had discussions about him.
Preller credited the work of two of San Diego's professional scouts, Steve Lyons and Tyler Tufts, for staying on Pirela during the season.
While Pirela's versatility probably plays better for a National League team than it does for an American League team, it was his bat that stood out to the Padres.
Pirela, who turns 26 on Nov. 21, is a right-handed hitter who has fared well during his career - the majority at the Minor League level -- against left-handed pitching. He hit .367 in 51 big league at-bats against lefties last season with the Yanks.
Pirela missed six weeks coming out of Spring Training with a concussion.
"We think he can hit," Preller said. "It's an aggressive swing. And he plays with a ton of energy."
For his professional career, Pirela is a .279/.346/.402 hitter.
Pirela played a lot of shortstop early in his career in the Yankees' system, though he played second base and three games in the outfield for the Bombers.
San Diego sees Pirela's best positions at third base and second base, and he has the ability to play the corner outfield positions.
Pirela is currently playing winter ball in Venezuela. He's hitting .406 in 64 at-bats with Aguilas de Zulia.
To get Pirela, the Padres dealt Herrera, 20, who was obtained in May 2014 from the A's as part of the deal that sent Kyle Blanks to Oakland. He had a 4.08 ERA in two Minor League stops a year ago. Herrera was one of the youngest pitchers in the Texas League following a promotion.
Corey Brock is a reporter for MLB.com. Keep track of @FollowThePadres on Twitter and listen to his podcast. This story was not subject to the approval of Major League Baseball or its clubs.