* Government survives vote but expected to resign shortly
* Bulgaria faces second snap election in barely a year
* Sofia faces tough decision on Russia gas pipeline
* S&P cuts ratings by notch on political instability (Adds S&P cut of Bulgaria's credit ratings to BBB-)
SOFIA, June 13 Bulgaria's coalition survived its fifth no-confidence vote on Friday but is still expected to resign soon after a poor showing by the ruling Socialists in May's European Parliament elections.
Friday's vote was just the latest chapter in a prolonged period of political instability dogging Bulgaria, the European Union's poorest member state, which has stymied urgently needed economic reforms and efforts to tackle pervasive graft.
The next government must also walk a diplomatic tightrope over the fate of the Russian-led South Stream gas pipeline, whose proposed construction has thrust Bulgaria into the middle of a dispute between Moscow, its Cold War overlord, and the EU.
Prime Minister Plamen Oresharski's coalition scraped through the parliamentary test with 114 votes to 109, although the nationalist Attack party voted with the centre-right opposition after propping up the government over the past year. Opposition lawmakers chanted "resign" as Oresharski walked into parliament.
Despite winning the vote, the government is due to quit within days or weeks after the Socialists bowed to calls from their coalition ally, which represents Bulgaria's ethnic Turkish community, and the opposition to hold the second snap election in little more than a year.
Ratings agency Standard and Poor's cut Bulgaria' sovereign credit ratings by one notch to BBB- on Friday and highlighted how the turmoil was hampering progress.
"We expect that the political landscape will remain volatile over the coming months and will likely not be conducive to implementing potentially unpopular reforms," the agency said.
President Rosen Plevneliev is expected to appoint a caretaker government until the election. Analysts expect the centre-right opposition GERB party to win, though it may struggle to cobble together a stable coalition government.
Underlining how the Bulgarian section of the pipeline may be held hostage to politics, GERB says it will scrap a contract worth more than 3.5 billion euros ($4.8 billion) awarded to a consortium led by Russia's Stroytransgaz if elected.
Stroytransgaz is owned by businessman Gennady Timchenko, who was put on a U.S. sanctions list after Russia's annexation of Ukraine's Black Sea region of Crimea.
Both Washington and Brussels have threatened to punish Bulgaria if it continues work on the project, which aims to pump Russian gas to European markets by circumventing Ukraine.
Oresharski on Sunday said Bulgaria had stopped work on the project until it got a green light from Brussels to continue.
"The South Stream pipeline cannot be stopped with one statement," said Socialist leader Sergei Stanishev, during a debate on South Stream that followed the no confidence vote.
"What is important actually is to take into account the political environment, to give a clear explanation (to the EU Commission) and see how to move this project forward because it is important for Bulgaria."
Bulgaria has enjoyed mostly stable governments since the fall of Communist rule in 1989. But street protests in 2013 toppled a GERB-led administration then nearly felled its Socialist successor.
The technocrat Oresharski has ruled in a minority coalition and faced down calls by protesters and the opposition to resign.
The next government will inherit sluggish growth of 1.3 percent, high unemployment and plummeting foreign investment.
The International Monetary Fund mission in Bulgaria on Thursday cited instability as a key risk to its outlook after predicting a modest pick up in Bulgaria's economic growth.
Standard and Poor's said the volatile political environment was likely to further delay needed reforms posed by widespread graft, inefficient judiciary and ageing population in the country of 7.3 million people.
Finance Minister Petar Chobanov said S&P did not take into account the start of the economic recovery but instead chose to focus on political risk.
Bulgaria's parties have yet to agree on when the election should be held. The Socialists want it in July, a date that other parties dismissed as unrealistic.
"The early elections will be most probably held in late September and we can expect the life of this cabinet to continue until mid-July," said Kancho Stoichev, from pollster Gallup. "This would be a logical step and it will allow the preparation of the elections in August and September." ($1 = 0.7345 Euros) (Writing by Matthias Williams; Editing by Alison Williams)