In which countries have governments been overthrown by guerrilla organizations or rebels?

What immediately comes to mind is that the Cambodian government was supported by the Khmer Rouge. Mao Zedong overthrew the Chinese government through guerrilla warfare. The Taliban overthrew the Afghan government twice. And the Spanish nationalists under Franco came to power through a civil war. Can you think of any more cases?

Why were North Vietnam and the Viet Cong allied with the Khmer Rouge?

The Khmer Rouge were nationalists who hated Vietnamese. Were they allies only because they had the same goal (to create a communist state)? According to English Wikipedia, they were allies in the Cambodian Civil War. https://en.wikipedia.org/wiki/Khmer_Rouge It's in the table at Allies. Later, the Cambodian-Vietnamese War broke out.