Not a bad Wednesday night at AT&T Park.
The San Francisco right-hander won in April for the first time since 2012 in the Giants' 6-2 victory over the Arizona Diamondbacks. He even doubled in the fifth inning to spur a go-ahead, three-run rally.
After a shaky first inning on the mound in which he allowed a leadoff triple and his only run, Cain (1-0) wound up surrendering five hits in five-plus innings. He struck out six and walked three.
Cain improved to 1-9 over his last 19 April starts.
The AT&T crowd rose in appreciation when he was removed from the game.
"Really, really nice moment there. Matty's been through a lot," Giants manager Bruce Bochy said. "He's really been battling to get on track. First game he was so-so, but I thought his stuff was OK. Tonight, was even better. ... Plus, he got us going there with that double. Great night for Matty."
Cain thought he was just missing by a little bit in the first inning, but the way his night ended was special.
"There's nothing better than to have that from the fans," Cain said of the ovation he received. "That's greatly appreciated."
The victory over the hot Diamondbacks (7-3) meant the Giants (4-6) avoided dropping a third consecutive series to start the season for the first time since 2007.
The Diamondbacks got to Cain early. A.J. Pollock led off the game with a shot into right-center field for a triple and promptly scored on David Peralta's sacrifice fly.
Cain walked two in the inning and seemed heading toward another disastrous April start, but he settled into a nice rhythm.
Cain brought the crowd to life in the fifth with a one-out double to left-center field and then came charging home as Denard Span lined a single to center on a 3-2 pitch from Shelby Miller.
The Giants added three more in the seventh, on Nick Hundley's double and Jarrett Parker's two-run triple.
Arizona's final run came in the eighth, when Jake Lamb scored on a single by Brandon Drury.
In the sixth, Giants reliever Cory Gearrin replaced Cain and struck out three straight batters to extinguish the threat. The reliever was thrilled to be able to contribute to Cain's big night.
"It's awesome. He did everything he could do tonight," Gearrin said of Cain. "He's hitting doubles in the gap. I think he pitched outstanding to give us a great opportunity to win that game. It's fun for us as a bullpen to come in after that. He really set the tone, kept them off balance."
Gearrin combined with relievers George Kontos, Derek Law and Hunter Strickland, each one working an inning, to limit the Diamondbacks to one run on just three hits.
Miller (1-1) allowed seven hits and three runs over 5 1/3 innings. He struck out five and walked two.
"I thought he threw the ball really well," Arizona manager Torey Luvullo said. "There was just the one inning where he gave up that double to Cain and they scored three runs on him. Besides that, there were some early quick outs, he was in command of all of his pitches."
Miller described the fifth as a "little rough."
"Just didn't make quality pitches that inning, and it kind of got away from me," he said. "This loss is definitely on me because I was in a groove and felt really good and just kind of gave it away right there."
NOTES: The Giants gave a minor league contract to veteran OF Melvin Upton Jr., who was released by the Toronto Blue Jays at the end of spring training. He hit 20 home runs last season -- most of them with the San Diego Padres. ... The Giants had a moment of silence before Wednesday's game in honor of Mirian Ortiz Cepeda, wife of Hall of Famer Orlando Cepeda, who died Wednesday morning at 62. ... Giants 2B Joe Panik, C Buster Posey and two-time winner SS Brandon Crawford received their 2016 Gold Glove Awards in a pregame ceremony. ... Giants manager Bruce Bochy says Posey, beaned in Monday's home opener, is feeling better, but it will be a few days before he will be full steam. Posey is on the seven-day concussion disabled list.