Sixth seed Elise Mertens fell to Kaia Kanepi 0-6 6-0 7-5 and seventh seed Julia Goerges lost to American Taylor Townsend 6-4 7-6(0).
Pegula broke the Latvian five times en route to an unlikely victory.
“Super special, because I’m from the area,” Pegula told the Post and Courier.
Wozniacki beats Martic in Charleston semi-final to set up Keys final
“I had a good feeling this week. I kind of went in knowing that I feel comfortable here, I feel good. I was just trying to ride that momentum.”
Caroline Wozniacki, seeded fifth, had little trouble with Laura Siegemund, beating the German 6-2 6-2 in just under 90 minutes.
“Today, I played a pretty decent match and I'm ready for tomorrow again,” said 2011 champion Wozniacki, who will next face 12th seed Mihaela Buzarnescu.
“Obviously the clay season you have the main goal, and that's the French Open, and that's what I try and peak for, and we'll see how it goes along the way.”
Third seed Aryna Sabalenka narrowly escaped an upset, coming from a set down to beat Kateryna Kozlova 3-6 6-3 6-3.
American eighth seed Madison Keys had to fight back from 4-3 down in the final set to defeat Germany's Tatjana Maria 7-6(5) 4-6 6-4.
Stephens fights from a set and two breaks down to reach Charleston quarters
Sakkari stuns defending champion Bertens at Charleston