And if so how old was the country
San Marino which is a small micro-nation within Italy. They democratically elected a Communist party which served from 1945 to 1957. They were the first and to my knowledge the only country to democratically elect a Communist regime into power in the world. The party was the Sammarinese Communist party they only got about a quarter of the popular vote but ruled the nation in a parliamentary style coalition government with the Sanmarinese Socialist party. Also San Marino is considered by some to be one of the oldest republic's in the world it goes all the way back to the Roman days.
A revolution? Not as such, but after World War II the Czechoslovak democracy was reestablished and in the first (and only) election the Communists became the largest, but not majority party, with 114/300 seats and 38% of the vote. The Communists (backed by the USSR), went into a coalition government with other parties, who eventually resigned in protest of the Communists' heavy-handedness. Unfortunately for the other parties, the Communists had been running the Interior Ministry and had appointed the soldiers and police and promptly declared themselves in charge of the entire government in February 1948, decisively pushing Czechoslovakia into the Communist bloc in the Cold War and ending democracy.
This was a coup, not a revolution, and the revived post-WWII Czechoslovakia was unstable to begin with.
It seems like there'd have to have been one in Latin America, but I'm really not sure.
In Cuba, Batista was democratically elected once, and voluntarily stepped down at the end of his term... but then ruined it by staging a coup after losing another election the next decade.
In Nicaragua, there were plenty of complications around the whole Sandinistas vs. Contras thing, but the Sandinistas did win an election, though, didn't they?
Edit to add: Ooo - a total technicality, but I bet you can find a political scientist who'd say South Africa would qualify. Maybe.
The ANC was in the Tripartite Alliance with COSATU (the unions) and the SACP (the communists), and I believe Mandela served some central function with the SACP at some point during the struggle.
That is, if apartheid South Africa counts as "democratic."
Would that one work?