SAN DIEGO -- Nationals left-hander Odalis Perez didn't know if he was going to pitch on Wednesday night against the Padres.

On Tuesday, Perez had a terrible toothache, which started during batting practice. It got so bad after the game that he asked the team to find an all-night dentist. There wasn't one available, so Perez ended up staying up in his hotel room watching SportsCenter on ESPN until finally falling asleep at 6 a.m. PT.

"Last night was the worst. It was thoroughly bad, bad, bad," said Perez, who had been dealing with the tooth problems for the last 10 days. "It was a battle for me."

Perez woke up two hours later and went to the dentist. He ended up in the dentist chair for more than four hours getting a root canal. When he arrived at PETCO Park, Perez felt weak because of the medication he was given by the dentist, but he never thought about missing his turn. He knew before the game he couldn't overpower the Padres, but he somehow found a way to keep them off balance and help the Nationals win the game, 6-4.

"I said, 'Let me get to the ballpark,' because I didn't feel good at all," Perez said. "When I came in, I took a pill, the pain went away and I was able to go out [on the mound]."

Perez gave up one run in his first six innings, but he was taken out of the game with one out in the seventh inning after giving up an RBI double to Tony Clark. Perez would be charged with another run when right-hander Brian Sanches gave up a two-run homer to Scott Hairston.

"I think [Perez] did a tremendous job," Nationals manager Manny Acta said. "The guy had a root canal this morning. He went out there and battled for us. I think we will schedule him [for another root canal] in five days."

Perez said he didn't get stronger until after the third inning. He believes drinking a lot of water helped him get better by the middle innings.

"I threw my fastball, but I had to locate it because I know I don't have the power to challenge those guys," he said. "I had to go to my other pitches. It was good for 6 1/3 innings."

Perez found himself in a pitchers' duel with Padres southpaw Shawn Estes during the first three frames. But Estes lost his control in the top of the fourth, giving up a single to Aaron Boone, walking Dmitri Young and hitting Lastings Milledge with a pitch to load the bases.

Jesus Flores came to the plate and was behind 1-2 when he hit a grand slam over the left-field wall. It was Flores' first career slam and Washington's second of the season. Felipe Lopez hit the first, against the Mets on April 24.

"He continues to have great at-bats for us, especially against left-handed pitching," Acta said of Flores. "He seems to have his way against lefties. The good thing about him is he hits for extra bases. He doesn't get rattled. With two strikes, that was a huge home run."

Flores was surprised Estes gave him a fastball, since Estes had thrown nothing but breaking balls to him before giving up the grand slam.

"I was looking for something away. In that situation, they don't want to give you a fastball," Flores said, who noted he's been hitting well when opposing pitchers throw him fastballs. "He made a mistake leaving the ball up. I had a good swing."

The Nationals added some insurance runs, and they turned out to be big. In the sixth inning, with Mike Adams on the mound, Milledge hit a solo home run. Boone hit a sacrifice fly to drive in Lopez the following inning.

With the Padres making it a two-run game in the seventh inning, Acta brought in Luis Ayala, who shut San Diego down for two innings.

"Ayala was the key for us," Acta said. "He came in with the heart of the order, basically with the tying run at the plate. He retired everybody he faced. He won the ballgame for us, pretty much."

Not only did Perez pick up his second victory of the season, he now can sleep better thanks to the root canal.