The two teams will play the rubber game of the series Wednesday at 6:40 p.m. MT.
Marshall has been a big contributor to the Arizona bullpen since being promoted from Triple-A Reno a few weeks ago and had gradually worked his way into pitching important innings.
This time he entered a tie game in the eighth and retired the first two hitters he faced before Medica stepped to the plate.
The first curveball Marshall threw Medica fouled it off. The second one was down, but more down the middle of the plate and Medica hit it just over the wall in left for a 4-3 San Diego lead.
"They were maybe the best two curveballs I've thrown this year," Marshall said. "We were pitching to the scouting report. He's a good fastball hitter. You try not to let him beat you, you try to execute pitches down in the zone, but he went down and got it. He's a good hitter, a strong hitter. He kind of showed that."
It was the second homer of the year for Medica and his second RBI of the night.
"It was a slider down," Medica said. "I wasn't looking for a slider there, but I stayed back on it and got the head of the bat out front and took advantage of the Arizona air."
The ball didn't clear the left field wall by much, but that was of little consolation.
"It's not about how much, as long as it clears that line," Marshall said. "It still hurts. A loss in a big league game is never something you want to have. But they're good hitters. Things like this happen. All I can do is continue to go out there and execute and next time I go out and face them try to have the opposite."
The D-backs had grabbed a 1-0 lead in the second when Martin Prado hit his first home run of the year.
Arizona starter Wade Miley, though, gave that lead right back in the top half of the third as the Padres scored three runs on five hits.
"It keeps happening," Miley said of his tendency to give up runs right after his offense scores. "It's got to stop sooner or later. They score a run, Prado hits his home run and then it's huge to have a shutdown inning right there. It's something I've got to get better at. I can't tell you how many times this year it's happened where we've got runs and I turn around and give some runs up. You look at that, it kind of throws the momentum back their way. It hurts."
Miley was able to shut San Diego down through the seventh as he compiled a career-high 11 strikeouts.
"I had a pretty good fastball tonight," Miley said. "I would say I was locating it in and out, I was able to get it in in a lot of situations and the offspeed was there when I needed it."
While Miley was keeping the Padres from inflicting further damage, the offense was finding a way to get back to even.
In the sixth, Paul Goldschmidt drew a leadoff walk and Miguel Montero followed with an RBI double to right-center to cut the San Diego lead to 3-2.
Some good fortune in the seventh helped the D-backs tie the score.
Cliff Pennington started the inning off with a line drive to right that Denorfia appeared to lose in the lights at the last minute and the ball bounced past him for a double.
Two outs later, Gerardo Parra singled to left to score Pennington.