Just three years ago, Tesla Motors was in big trouble. The company’s inaugural product—the $109,000 Tesla Roadster—was a money-loser before a single unit had been delivered.