PETER Murrell, the SNP's mild-mannered chief executive and the architect of its election victory, isn't given to displays of high emotion.

Deputy First Minister Nicola Sturgeon’s other half tends to leave the talking to his partner.

But as he waited on the dappled lawn of Prestonfield House on Friday for Alex Salmond’s helicopter to arrive, he allowed himself a moment of stunned exhilaration.

“Wow! Wowww!” he said of the result which had produced Holyrood’s first overall majority.

Wow indeed. In some parts of the country the SNP almost ran out of candidates to elect as a wave of first-past-the-post victories dried up the pool of potential list MSPs available.

Indeed, the party now has so many MSPs that there is no room big enough at Holyrood to hold them.

The 69-strong group will have to convene its weekly meetings in the debating chamber.

“We missed this coming,” said another of the SNP’s inner circle about the scale of the win. “We didn’t even plan for this scenario.”

Even Salmond, no doubter of his own ability, was gobsmacked.

His audible disbelief was almost broadcast by the BBC after he was told the SNP had beaten Labour in Clydebank.

“F*** me,” he whistled in an unguarded moment.

So how did the SNP break through Holyrood’s tartan ceiling and pull off a win that, in theory at least, was meant to be impossible, a win Murrell admits might never be repeated?

The bedrock of the result was the SNP campaign, but achieving an overall majority required unwitting contributions from Labour and the LibDems too.

First, Labour misread the election, believing a Tory prime minister would galvanise its core support and attract swing voters.

But people were more sophisticated, voting on Holyrood issues, not who occupied Number 10.

Labour was also hobbled by a one-dimensional, uninspiring leader in Iain Gray and a scrappy manifesto full of ideas poached from the SNP and scaremongering about the Tories and crime.

Ironically, Labour had been on to something when it felt Westminster was important – it just focused on the wrong half of the Coalition.

It was the LibDems who really animated voters.

Labour’s mistakes and the LibDem backlash proved key to the final result, but on their own they would not have been enough to guarantee the SNP even a win, far less a landslide.

What ultimately won it for the SNP was Alex Salmond and his projection by a campaign even Labour sources concede was “flawless”.

Like the failure of Labour’s campaign, the success of the SNP’s had long roots.

In effect, the party tried to extend the positive message of its 2007 election, and turbo-charge it with a record of achievement in government and a first-class team at the helm.

The official mantra was “record, team, vision”.

The SNP also brought an unprecedented level of professionalism to the election.

The central team consisted of Murrell, MP Angus Robertson, policy chief Stephen Noon, spin doctor Kevin Pringle, marketing guru Ian Dommett of the Cor Agency, and Kirk J Torrance, head of the party’s digital media team.

Pivotal, as it was in 2007, was the party’s bespoke voter database, Activate.

A record of all 3.9 million voters, it also showed which people had voted previously, and how they fitted into 44 consumer types identified by postcode, family type, income and age.

The SNP reckoned it could win by appealing to around 20 demographic groups, and went after them with a vengeance.

For example, instead of wasting money leafleting serial non-voters in Labour council estates, Activate could pinpoint regular, aspirational voters in new-build houses popular with families.

There was also an Activate smartphone App, which told activists on the ground the nearest doors to knock on, then let them feed their canvass returns back instantaneously, updating Activate.

In some weeks, the SNP was able to canvass 25,000 people. Most commercial polls talk to around 1000 people.

While the polls fluctuated wildly, Activate showed a steady rise in SNP support, from 35% last September, to 40% at Christmas, to 46% last week.

At 40% the SNP would win, but at 45% it was into the twilight zone where an overall majority was possible, despite the electoral system being explicitly designed to prevent it.

Activate also showed support in each of the 73 constituencies, telling the SNP where to deploy people and resources to best effect.

On May 5, activists at polling stations fed back live information on turnout. Based on what was coming in from the counts and from Activate, Murrell and his chief number-cruncher Mark Shaw predicted that historic overall majority as early as 6.24am on Friday.

Activate and the activists were the behind-the-scenes trump for the SNP, but what the public saw was the “Six Gears” strategy, as the party focused its message in the 10 months up to polling day.

The first phase in July and August saw focus group expert Mark Cuthbert tell the party what he’d discovered about the public’s attitude toward the Government and to Salmond as First Minister.

Essentially, people wanted a government that appreciated their concerns, delivered results, and knew where it was going.

This was distilled into “record, team, vision”, with a five-year council tax freeze the central policy, and re-electing Salmond as First Minister the main message.

Phase Two kicked off at October’s SNP conference, when the focus was on the team element, with a campaign anthem “Let’s work together” and slogan “Together we can make Scotland better”.

Phase Three began on Burns Night when the SNP started to push the “re-elect” message.

Phase Four started in mid-March at the spring conference, when Salmond and other speakers foregrounded the “record and team” elements of the message.

The party unveiled its election broadcast, based on the What Have the Romans Ever Done For Us? sketch from Monty Python’s Life Of Brian, in which a pub bore derides the SNP only for other drinkers to reel off a catalogue of SNP achievements.

The party also began to wheel out a series of celebrity backers starting with artist Jack Vettriano.

For the SNP, these people were more important for what they represented than who they were, as they had invariably backed Labour, but were now changing to the SNP.

Strategists saw them as psychologically important in offering voters a lead, and “legitimising” a shift in allegiance.

Meanwhile, Labour produced Manchester United manager Sir Alex Ferguson, as it always does, showing it was narrowly focused on its core vote while the SNP were pursuing switchers.

When Holyrood dissolved in late March, a 24/7 war room was created at party HQ.

Fifth gear, when the campaign dramatically accelerated, was marked by the manifesto launch in mid-April. Because few people actually read manifestos, the party created mini-manifestos to download on its website, and nine-word messages for Facebook pages, all starting “Both votes SNP because...”.

The sixth phase saw the SNP go full throttle on the “both votes” message in the last fortnight to maximise list as well as constituency seats, a mailshot to all 2.4m homes, and adverts directly targeting disaffected Liberal Democrats.

It was a perfect end to a perfect campaign. But there was something else going on.

This was the first Scottish election with a genuine, integrated online campaign.

In the past, the internet had been an afterthought for most parties, but in 2011 the SNP reached tens of thousands of people online.

For barely £3000, the price of 10,000 leaflets, it created a website using the “Nation Builder” system which helped get Barack Obama elected. This translated online interest into off-line, real-world activity in targeted SNP seats.

Every Cabinet Secretary had a Twitter account, and talked to voters online in spare moments. SNP staff also talked with Twitter posters, converting them with links to SNP material and reasons to vote.

These Facebook and Twitter conversations had hundreds of followers, who in turn told their followers.

“It’s the first European election where online has swayed the vote,” said Ewan McIntosh, a digital media consultant brought in by the party. “And yet the digital side cost peanuts.”

The SNP also had money from Brian Souter, and a young, energetic activist base that left Labour trailing.

“The Nats ran a better campaign, a stronger campaign, a more focused campaign, and we were all at sea,” admitted one senior Labour source.

The SNP’s victory was historic, but it also contained the seeds of trouble to come.

Many of the policies spawned in the focus groups are hugely expensive. A two-term council tax freeze, for instance, would ultimately cost £2.5bn. Free university tuition, 1000 extra police, and protecting NHS spending are similarly costly.

But budgets are falling, and the 2% efficiency savings Salmond is relying on are likely to be wiped out by rising demand for services such as care for the elderly.

Offering the public what they want might get you elected, but giving it to them is much harder.

So expect this summer’s Christie Commission to be the excuse for a major rethink, and the start of five years of back-pedalling. As Salmond no longer has minority government to excuse his failings, he is in for a lot of flak.

He promised big – very big – and he may yet pay for it.