France is one step closer this morning to choosing a candidate to challenge Nicolas Sarkozy for the presidency next spring. The opposition Socialist Party's open primary on Sunday drew a surprisingly high 2.5 million voters. Former party boss François Hollande came out on top with 39 percent of the vote, according to provisional results. He will face his successor at the head of the party, Martine Aubry (31 percent) in a run-off next Sunday. After years of the party acting like a political basket case prone to hysterical psychodrama, Sunday's vote was itself a triumph. The challenge now, as the field narrows, will be to keep the proceedings classy.

The left-leaning daily Libération's cover on Monday cheers “The Left Wins Its Election,” under a big red cartoon rose, the Socialist Party logo. It is not hyperbole. This is a party that, over the last five years, strayed into degrees of dysfunction not befitting the official opposition of a modern democracy. But with this open primary (unprecedented in France) and against all odds, the Socialists seem to be peaking at the right time, poised to give Sarkozy a real race. Under the circumstances, the fact that the primary campaigns, the televised debates between six candidates, and Sunday's first-round vote went off uneventfully counts as an astonishing success.

In the presidential race of 2007, Socialist Ségolène Royal was soundly beaten by Sarkozy, 53 percent to 47 percent. Not the party apparatus's preferred choice, Royal netted the nomination over future International Monetary Fund head and eventual Rikers Island tenant Dominique Strauss-Kahn, as well as over a former prime minister, by wooing the grassroots—she waged a campaign largely outside her own party. (The Socialists' were led at the time by Hollande, Royal's romantic partner of more than 25 years and father of her four children. It was only officially revealed after the election that the couple had long been separated.)

At first, Sarkozy looked poised to decimate his weakened and squabbling opposition by cherrypicking many of its top talents, promising cushier posts to the turncoats than five years in opposition could offer. New foreign minister Bernard Kouchner, the iconic cofounder of Doctors Without Borders and long the most popular of Socialists, was one of several leftists named to the right-wing Sarkozy's cabinet. Other were coopted to lead prestigious commissions. And Sarkozy showily backed Strauss-Kahn's bid for the IMF's top job, dispatching a potentially dangerous rival to what was then (before the global financial meltdown) an institutional backwater in Washington.

The Socialists were mired in perpetual internecine bickering for years. The battle to choose a successor to Hollande in 2008 couldn’t have been uglier. Aubry finally beat Royal—after the result was held up for four days by tense recounts—50.02 percent to 49.98 percent, winning by an incredible 102 votes out of 135,000 cast. For months, even years, the two women appearing in the same room together counted as news. As recently as 2009, the philosopher Bernard-Henri Lévy compared the party to a decomposing corpse. “It is dead. No one, or almost, dares say it. But everyone, or almost, knows it,” Lévy told a newspaper, launching the party into a new round of tortured soul-searching.

Earlier this year, the party thought it saw light at the end of the long tunnel in the figure of Dominique Strauss-Kahn, sworn to silence on his home country's politics by IMF rules but dominating Sarkozy in the polls. But that plan was quashed in the space of Strauss-Kahn’s nine-minute encounter with a chambermaid in the Times Square Sofitel. Strauss-Kahn, only weeks from throwing his hat in the ring, was down for the count. The Socialists' best hope for 2012 was suddenly a grizzled shadow of himself, perp-walked into infamy. Their disgraced star candidate and the lurid details of his political demise stole the party's thunder, but also deprived candidates of coverage through the summer as the party kept to the primary schedule and strove to establish a replacement for DSK. Today, against those stacked odds, Hollande and Aubry both crush Sarkozy in early polling for next April's first-round presidential ballot.

And so it looked like sour grapes on Sunday night when the head of the UMP, Sarkozy's majority party, downplayed the voter turnout on TV minutes after polls closed. Sarkozy, it bears noting, has chronically low approval ratings, seemingly no matter what he does, even winning a war in Libya. The press has been chiding the embattled president about the end being near, what with many of his associates on the hook in a series of slimy scandals. Hollande may have touched a nerve when he suggested last month that Sarkozy wouldn't survive a primary in his own party. If nothing else, the Socialist primary managed to do what Sarkozy usually excels at, dominating the airwaves, topping the news even as the president traveled to Berlin Sunday for key talks with German Chancellor Angela Merkel on the European debt crisis.

So the popular victory is something indeed, and was hard-earned. But the week leading up to next Sunday's run-off is the riskiest yet. Hollande and Aubry, the favorites through the summer, have played it fairly safe so far, almost certain as they were to pass the first round. One surprise last night means there is real suspense for next Sunday's deciding vote. Arnaud Montebourg, an unheralded candidate who leaned hard left stumping for “deglobalization” and for putting the banks under guardianship, finished third with an impressive 17 percent of the vote. Montebourg becomes the unlikely kingmaker. Footage of Royal in tears, recovering from her unexpectedly poor fourth-place (7 percent) finish, is a fixture in the 24-hour news-channel loop Monday.

The strict political math after the first round now favors Aubry, best known abroad for the 35-hour workweek she shepherded into law as a Socialist cabinet minister in the 1990s, with harder-left candidates scoring higher than the center-leftists more in tune with Hollande. But the game of alliances has begun, the horse-trading for endorsements. There will be side deals and efforts to contort platforms to draw new votes that make predictions hazardous. A key TV debate Wednesday night favors Hollande, considered the better public speaker. And the fact Hollande polls higher than Aubry in faceoffs against Sarkozy for the ultimate prize should help him as the left is desperate not to lose a fourth consecutive presidential election. Importantly, as in the first round of this wide-open primary, the Socialist Party cannot really know until the ballots are counted who turned up to vote on the day.

If the Socialist Party get through the second round with as much popular goodwill as it seems to have rallied though the first, it will enter a six-month race with momentum beyond its wildest dreams through recent, very dark years. And so the best advice is simple: try not to do anything stupid.