CINCINNATI — San Francisco Giants pitcher Casey Kelly had a big fan in the Cincinnati dugout — his dad, Pat, is the Reds bench coach.

Starting two days after pitching in relief, Kelly worked into the fifth inning Friday night. The Reds eventually won, 2-1 on a leadoff home run by Phillip Ervin in the 11th inning.

Ervin connected against Ray Black (2-2) for a drive over the centre field fence for his third homer of the season. It was his first walkoff home run since his sophomore year at Samford against Auburn.

"It's exciting. It's a great feeling," Ervin said. "I knew it had a chance."

The 28-year-old Kelly limited the Reds to one run in 4 1/3 innings despite giving up nine hits and a walk.

Kelly threw 1 1/3 innings against the Dodgers on Wednesday night. When the Giants put pitcher Dereck Rodriguez on the disabled list Thursday, Kelly was tabbed for his 10th big league start, and first since May 22, 2016, with Atlanta.

"As a starting pitcher, you always want to finish five or six innings," he said. "You want to go as deep into the game as possible."

Kelly and his dad saluted each other before things got going.

"Once I threw that first pitch, it was me against the Reds," he said.

Kelly made his major league debut with San Diego in 2012. He's been sidelined with Tommy John surgery, and this was his third outing for the Giants.

"He got into traffic, but he kept his poise," San Francisco manager Bruce Bochy said.

"Kelly did a nice job under the circumstances, coming back on one days' rest," he said.

Among the Reds that Kelly faced was All-Star Scooter Gennett, a former high school teammate. Gennett finished with three hits.

David Hernandez (5-0) struck out two in a perfect 11th inning as the Reds ended a four-game losing streak.

Andrew McCutchen had three of San Francisco's eight hits.

Cincinnati starter Anthony DeSclafani pitched a season-high 7 2/3 innings, giving up six hits and one run with one walk and five strikeouts. He retired 11 consecutive batters from the fifth into the eighth.

DeSclafani has pitched seven or more innings in each of his three starts with two wins and Friday's no-decision.

"I know I'm capable of pitching into the seventh or eighth inning," the right-hander said. "It is good to string three or four good starts together. I'm feeling comfortable right now. I'm focused on locating pitches."

The Giants' bullpen turned in 5 2/3 shutout innings before Ervin's blast.

The Reds took a 1-0 lead in the second when Tucker Barnhart doubled and Curt Casali singled. The Giants tied it in the third on Steven Duggar's leadoff double, Kelly's sacrifice and McCutchen's single.

BACK ON TOP

Reds CF Billy Hamilton batted leadoff for the first time since April 26 against Atlanta. He had made 62 consecutive starts batting ninth.

WHO'S ON FIRST?

Barnhart, Cincinnati's Gold Glover behind the plate, made the first start of his career at a position other than catcher, manning first base in place of the injured Joey Votto.

TRAINER'S ROOM

Giants: RHP Jeff Samardzija threw 50 pitches to batters while getting up and down three times before the game. He'll be evaluated on Saturday and could go on a rehab assignment Wednesday, manager Bruce Bochy said. Samardzija has been on the disabled list since July 15 with right shoulder inflammation.

Reds: Votto went on the 10-day disabled list with a right lower leg contusion, the result of being hit by Ryan Madson's pitch in Washington on Aug. 4.

UP NEXT

Giants: LHP Madison Bumgarner (4-4) is 1-2 with a 4.18 ERA in six games at Great American Ball Park.

Reds: RHP Matt Harvey (5-7) went seven innings in his last start for the first time since April 21, 2017, for the Mets.