David Cameron was saved last night from the embarrassment of losing one of the most high-profile sections of the Conservatives after members north of the border voted against plans to dissolve the Scottish party and start something new in its place.

Murdo Fraser, the outgoing deputy leader of the Scottish Conservative Party, was defeated in his attempt to take control of the party north of the border, disband it, break away from the UK party and create a new centre-right entity.

The Prime Minister did not endorse any one candidate publicly but it was understood that his favoured candidate was Ruth Davidson, a charismatic 32-year-old former television producer.

Ms Davidson, an openly gay first-time MSP, won the leadership contest relatively comfortably yesterday. She saw off the challenge from Mr Fraser – and saved the Scottish Conservative Party for the foreseeable future – by a margin of 500 votes from the 5,500 or so cast.

But there were signs that Ms Davidson's victory – and Mr Cameron's relief – may be tested severely as the divisions exposed by Mr Fraser's defeated plan continue to plague the party. Mr Fraser argued that the Scottish Conservatives had been declining in Scotland for decades and that only a change so radical as reinventing the party would save it and bring new members and donors to it.

Mr Fraser had the support of a majority of Tory MSPs in the Scottish Parliament as well as some influential donors and more than 2,000 ordinary party members. Mr Fraser was also backed by the former foreign secretary Sir Malcolm Rifkind, the former presiding officer of the Scottish Parliament Alex Fergusson and the senior MEP Struan Stevenson.

If only some of Mr Fraser's many supporters fail to rally to Ms Davidson's cause of saving the Scottish Conservative Party, then the effects of this most bitter leadership battle are likely to roll on for some time and damage Ms Davidson's attempts, not only to unify the party, but to build it back up to some sort of electoral respectability.

The Conservatives in Scotland won only one seat at last year's General Election and they have done no better than that since their wipe-out in 1997 when they lost all their Scottish MPs in a nationwide backlash against the Westminster government.

Ms Davidson has to smooth over the divisions exposed by the leadership contest, unify the party then tackle Mr Salmond and his independence plans before showing she can start winning seats in Scotland, something that has been beyond vastly more experienced politicians than her.

Ms Davidson said her priority was to build the Conservative membership in Scotland. "A political party is not its leader," she said. "A political party is its membership." She promised to reveal more of her plans to revitalise the party within days.

Ms Davidson does have her own high-profile supporters, most notably the former Scottish secretary Lord Forsyth who declared during the campaign that, like Margaret Thatcher, Ms Davidson had "the balls" to tackle a tough job and do it well.

As they celebrated her victory last night, Ms Davidson's supporters were also keeping their fingers crossed and hoping that Lord Forsyth was right.

1955: true-blue year

The year 1955 is etched into Scottish Conservative political history. Everyone involved with the Tories north of the border knows its significance, and how far the party has fallen since. That is because the General Election of 1955 was the highwater mark for Conservatism in Scotland, when they and their allies won the most Scots seats and votes. The Conservatives and the parties they were allied to (the Liberal Unionists and National Liberals) won 36 seats to Labour's 34 and 50.1 per cent of the vote to Labour's 46.7 per cent. The Liberals won 1.9 per cent of the vote, with the Communists and the SNP tied on 0.5 per cent.