Victor Martinez drove in three runs to help Detroit to a much-needed win, then offered a bit of a plea to Tigers fans who have been losing patience with the AL Central favorites.

"It's not fair when people out there are thinking that we've got to win this division by 10, 15, 20 games," Martinez said. "We're not playing Little League teams. We're trying. It's too long of a season. At some point you're going to struggle. Every team struggles at some point.

"As a fan, if you're going to be with us when we're doing good, we really need the fans when we're struggling too."

Martinez had three hits, and Nick Castellanos homered and tripled to lead the Tigers to an 8-4 victory over the Pittsburgh Pirates on Wednesday night.

Detroit rallied from a 4-1 deficit and snapped a four-game losing streak, but the Tigers remained a half-game behind first-place Kansas City.

The Tigers are suddenly facing adversity amid mounting injuries. They had to send Buck Farmer to the mound to make his major league debut, and he allowed four runs in five innings.

Blaine Hardy (2-1) followed with two scoreless innings of relief, lowering his ERA to 2.05. He's been a rare bright spot in a bullpen that's been unreliable.

Rick Osentoski-USA TODAY Sports

Nick Castellanos celebrates his sixth-inning home run Wednesday.

"He's done an excellent job, really," manager Brad Ausmus said. "He's not strictly a lefty-lefty guy. He's got the ability to get right-handed hitters out, which gives me a lot of flexibility in the middle innings."

Castellanos put Detroit ahead 5-4 with a solo homer off Vance Worley (5-2) in the sixth. Martinez added a bases-loaded single in the seventh.

The Tigers returned home after going 2-7 on a road trip against the New York Yankees, Toronto and Pittsburgh. A 19-inning loss to the Blue Jays stretched the pitching staff thin, and Anibal Sanchez and Justin Verlander are nursing injuries.

The game was tied at 1 in the fourth when Pittsburgh's Jordy Mercer hit an RBI triple and Travis Snider followed with a two-run homer. The Tigers tied it with three runs in the fifth.

Alex Avila led off with a homer to make it 4-2, and after a single by Eugenio Suarez, Ezequiel Carrera hit a grounder to second. Jayson Nix tried to make a tough throw to second to get the lead runner, but his throw was poor, and the error helped Detroit to a big inning. Miguel Cabrera eventually hit a sacrifice fly, and Martinez tied it with a two-out RBI single.

Castellanos hit his ninth homer of the year with one out in the sixth.

"I think the pitches that hurt were the home runs," Worley said. "Couple of guys who I got behind -- had to throw good pitches."

Worley allowed five runs -- three earned -- and nine hits in 5 1-3 innings.

TOUGH SPOT: Farmer has spent most of this season at Class A West Michigan, and he was called up from Double-A Erie to make this start for the Tigers. He made it through the order the first time without allowing a hit, but the Pirates scored a run in the third and three in the fourth.

He allowed six hits and a walk and struck out four, and the Tigers were able to rally after he left the game.

OUTFIELD PROBLEMS

Pittsburgh center fielder Starling Marte made a diving attempt on Castellanos' hit in the second, and the ball got past him for a triple. Right fielder Gregory Polanco couldn't handle Torii Hunter's double in the fourth, and Polanco's long run to right-center in the seventh was for naught when he was unable to make the catch on Carrera's drive, which went for a triple.

FOR THE BIRDS

Worley and Cabrera both seemed distracted by two birds that settled in between the mound and the plate while Cabrera was batting in the first. Cabrera stepped out and waved his bat at them, then Worley rolled a ball to the plate, trying to shoo them away.

TRAINER'S ROOM

Pirates: Pittsburgh was once again without 2B Neil Walker, who has been limited to only three games this month. Walker has been bothered by a bad back.

Tigers: Detroit 2B Ian Kinsler stayed in the game and seemed to be OK after a pitch by Stolmy Pimentel bounced weirdly and hit him in the side of the head. Pimentel's pitch in the seventh inning was in the dirt, then bounced up off C Russell Martin and hit Kinsler.

UP NEXT

Pirates: Francisco Liriano (3-8) takes the mound for Pittsburgh on Thursday against Detroit. He's posted a 2.25 ERA in five starts since returning from a left oblique strain.

Tigers: Max Scherzer (13-4) pitches for the first time since striking out 11 in eight innings against Toronto on Saturday -- in a game Detroit went on to lose in 10.