The “Sox” part of Jake Peavy’s uniform won’t change. (Charles Rex Arbogast / AP)

The Boston Red Sox took a gamble Tuesday night, beefing up their starting rotation by acquiring Jake Peavy and giving up talented defensive player Jose Iglesias in a three-team, seven-player deal on the eve of the trade deadline.

In the closest thing to a “whoa” trade so far, the Red Sox sent Iglesias to the Detroit Tigers along with three prospects (J.B. Wendelken, Francelis Montas and Cleuluis Rondon) and, in addition to obtaining Peavy from the Chicago White Sox, also acquired Brayan Villarreal, a Class AAA righthander, from Detroit. Chicago also obtained outfielder Avisail Garcia, a top prospect who was the key player for them in the deal, from Detroit. In Iglesias, the Tigers have someone who could step in if/when Jhonny Peralta is suspended because of his involvement with the Biogenesis clinic.

The Red Sox can use Peavy, one of the best starters on the market this year, while they await the return of Clay Buchholz from the disabled list in late August or early September.

“We’re in a position to compete for a playoff spot and we felt like adding a starting pitcher was one of the most important things we could do,” Red Sox General Manager Ben Cherington said (via the Boston Globe). “This was the deal we thought made the most sense. We just thought that Peavy, of the starting pitchers available, was the one that made the most sense to us.”

Peavy, 32, won the Cy Young award with San Diego in 2007 and is 8-4 with a 4.28 ERA in 13 starts this season. More importantly, in 45 starts since the beginning of the 2012 season, he has won 19 games and has an ERA of 3.61. He is under contract through the 2014 season, making him even more appealing to the Red Sox.

“That was important,” Cherington said. “If we were going to give up a long-term asset in Iglesias that we were getting someone we would control past this year was important.”

The non-waiver trade deadline is 4 p.m. EDT today.

Follow @CindyBoren on Twitter and on Facebook.