* CDU largest party by a whisker but may lose power
* SPD could form three-way coalition
* Merkel wants third term but must swap partner (Corrects paragraph three to read "ethnic Danish minority")
By Erik Kirschbaum and Alexandra Hudson
BERLIN, May 6 (Reuters) - Chancellor Angela Merkel's conservatives were in danger of being ousted from power in another German state on Sunday after the opposition Social Democrats (SPD) said they wanted to form a three-way coalition with two smaller centre-left parties.
The Christian Democrats' (CDU) vote fell to 31 percent, their worst result in the state since 1950, but they were still just the largest party in the rural region between the Baltic and North Seas, a projection by Germany's ARD TV network showed.
The SPD, which won 29.9 percent in the northernmost state, said it wanted to form a coalition with the Greens and South Schleswig Party (SSW) that represents the ethnic Danish minority. The three parties would have 35 seats in the 69-seat state assembly.
Merkel's conservatives have been voted out of power in three states in the last two years. If knocked out in the traditionally conservative region of Schleswig-Holstein the CDU would rule just seven of Germany's 16 states ahead of the 2013 federal election, when Merkel is seeking a third term.
"She'll probably lose another state premier and this will make things harder for her re-election campaign," said Gero Neugebauer, political scientist at Berlin's Free University.
"She can't be satisfied about the performance of her centre-right coalition."
The chancellor's resolute stance through the drama of the euro zone crisis has left her personal popularity intact. But her national centre-right coalition has looked in jeopardy after a slump support for her junior coalition partners, the Free Democrats (FDP).
The pro-business FDP's vote fell to 8 percent in Schleswig-Holstein from 14.9 percent in the last election in 2009. The party managed to stop the rout that has seen them ejected from five state assemblies in the last 18 months but its support was not enough to continue the CDU-FDP coalition in the state.
"There were two losers in Schleswig-Holstein: the CDU and the FDP," said SPD chairman Sigmar Gabriel.
"If they can't figure that out, that shows they're not very good at mathematics and that they don't understand German politics. Parties that lose don't belong in the state government."
Gabriel, who may lead the SPD into the 2013 election against Merkel, added the SPD and Greens, who climbed to 13.3 percent from 12.4 percent, were the big winners of the night along with the anti-establishment Pirates, who won 8.5 percent of the vote to enter a third regional assembly.
There had been speculation before the election that the CDU and SPD would form a "grand coalition" if neither party could form a coalition with their preferred junior partners.
SPD leaders, who had hoped to form an SPD-Greens coalition, were surprisingly clear about their desire to enter a somewhat risky alliance with the SSW even though their attempt to form such a three-way coalition in 2005 turned into a debacle.
"Schleswig-Holstein needs a stable government," said Hermann Groehe, the general secretary of Merkel's CDU, in a blunt appeal to the SPD to form a grand coalition with a large majority than rely on the one-seat majority with the Greens and SSW.
But Kiel mayor Torsten Albig, the SPD leader in Schleswig-Holstein, said he was going to pursue a three-way coalition with the Greens and SSW, which won 4.6 percent but will still get assembly seats as it is exempted from the five percent hurdle.
"We're going to do everything possible to form a government with the Greens and SSW," Albig said. "That's our goal. If that doesn't work, we'll see what other coalitions are possible."
The close result in Schleswig-Holstein, home to 2.8 million people bordering Denmark, means an unusually large number of coalition options are possible. Coalition talks are not expected to start in earnest until after next Sunday's election in North Rhine-Westphalia (NRW), Germany's most populous state. (Additional reporting by Alice Baghdijan; editing by Andrew Roche)