Before a giant run-up in Tesla's (NASDAQ:TSLA) share price from about $40 in the first half of 2013 to $205 today, CEO Elon Musk had shook hands on a deal with Google (NASDAQ:GOOG) (NASDAQ:GOOGL) CEO Larry Page to sell the electric car-maker to the search giant, according to a just-released excerpt from Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future, a new book by Bloomberg's Ashlee Vance due for a May 19 launch. On the brink of bankruptcy, Musk was counting on Google for a solution, Vance explained. But thanks to an aggressive companywide campaign to focus solely on delivering cars, Tesla reported its first profit on May 8 and shares began a long and rapid uphill march.

Elon Musk Thinking

The turnaround
Going into Tesla's fourth quarter of 2012, the company had guided for 2,500-3,000 deliveries of its fully electric Model S -- a huge jump from the 250 delivered in Q3, reflecting the company's efforts to ramp up production.

But Tesla fell short of its own guidance in Q4, delivering 2,400 vehicles. Investors worried demand for Model S may not be robust enough for the company to meet its aggressive guidance for 2013 deliveries of 20,000 vehicles.

While the Tesla growth story quickly turned positive on April 1, 2013 when Tesla released its Q1 deliveries early, announcing it exceeded its first-quarter guidance for 4,500 vehicles by 250, it was the months between the February 20 fourth-quarter report and Tesla's April 1 release of its Q1 delivery figure when Musk, in desperation, turned to Google for a bail from near bankruptcy.

In early 2013, Tesla was having trouble converting the 15,000 orders for Model S it reported in its fourth-quarter letter to shareholders into actual sales, Vance said that it turned out the Silicon Valley-based start-up's attempt at challenging the renowned Mercedes S Class in one of the most capital-intensive industries on the planet was an incredibly difficult task. The Model S was lacking in some key areas when compared to other luxury cars.

Tesla Model S

Model S. Image source: Tesla Motors.

"Its safety elements, software, and interior room were better than those of most luxury cars, but it didn't offer the parking sensors and radar-assisted cruise control of rivals like BMW and Mercedes-Benz," Vance said. "Glitches with the 2012 Model S door handle irked early buyers, as did some aesthetic choices such as the car's sun visors, which had unsightly seams."

To save the company, Musk put Tesla staff "on crisis footing" and simultaneously reached out to Page.

Vance summarized the terms Musk took to Page during the first week of March:

Considering his straits, Musk drove a hard bargain. He proposed that Google buy Tesla outright — with a healthy premium, the company would have cost about $6 billion at the time — and pony up another $5 billion in capital for factory expansions. He also wanted guarantees that Google wouldn't break up or shut down his company before it produced a third-generation electric car aimed at the mainstream auto market. He insisted that Page let him run a Google-owned Tesla for eight years, or until it began pumping out such a car. Page accepted the overall proposal and shook on the deal.

And back at Tesla headquarters, Musk spared no mercy.

"If we don't deliver these cars, we are f---ed," Musk told his staff. "I don't care what job you were doing. Your new job is delivering cars."

Just as Google's lawyers were negotiating specific terms on the deal with Musk and Page, Tesla's aggressive sales effort began to pay off. With just "two weeks of cash in its coffers," Tesla finished the quarter strong, beat guidance, and reported an $11 million profit.

Tesla's success persisted. On May 22, Tesla repaid its loan from the Department of Energy with a $451.8 million wire, making Tesla the first American car company to have fully repaid the government. Tesla went on to exceed its initial annual guidance for 20,000 Model S deliveries, putting about 22,500 Model S in the hands of customers. Meanwhile, the company has tightened up quality control and jumped into the leading position in autopilot and driver-assist features.

Tesla Auto Pilot Lane Change

Tesla is pushing out software updates to its 2015 Model S and later that is getting the car closer to the company's goal for hands- and feet-free driving from highway on-ramp to highway off-ramp. Image source: Tesla Motors.

Tesla is better off
While a $6 billion price tag on Tesla may have made sense at the time, Musk and Tesla shareholders have seen a far better return as an independently operated company than would have been the case if the Google and Tesla deal panned out. Today, Tesla's market cap is $26 billion.

The near-Google deal highlights the risk of investing in companies like Tesla who spend every dollar of gross profit on expansion. Even amid sales growth, cash can be tight. Of course, the risk of bankruptcy today is far lower, if not nonexistent. Tesla's premium stock price, paired with a much better track record of demand for its vehicles, gives the company much easier access to capital today -- whether it's through debt or equity.

Daniel Sparks owns shares of Tesla Motors. The Motley Fool recommends Google (A shares), Google (C shares), and Tesla Motors. The Motley Fool owns shares of Google (A shares), Google (C shares), and Tesla Motors. Try any of our Foolish newsletter services free for 30 days. We Fools may not all hold the same opinions, but we all believe that considering a diverse range of insights makes us better investors. The Motley Fool has a disclosure policy.