The chips--at least some of them--are starting to fall into place for Elon Musk and his master plan.

After analysts had predicted a loss, Tesla announced its first profitable quarter in three years on Wednesday. Revenues came in at $2.3 billion, beating expectations by more than $300 million.

The timing couldn't be better: Tesla is only three weeks away from a shareholder vote on the proposed $2.6 billion acquisition of SolarCity--an acquisition Musk maintains is necessary for both companies to reach their full potential.

The entrepreneur has been handily ripped by industry analysts and his own shareholders in recent months. Musk is co-founder and CEO of Tesla and co-founder of SolarCity, which is currently run by his cousin. Both companies' stocks fell immediately after the agreement was announced August 1. Since then, analysts have called the deal a "brazen bailout" of SolarCity--which has never posted an annual profit--and said it will create a "cash flow sinkhole" for Tesla.

But that view might be changing. Ben Kallo, senior research analyst at investment firm Baird, tells Inc. that investors are starting to come around on SolarCity's potential to make money. Tesla recently announced a deal with Panasonic to make solar panels at its factory in Buffalo, New York, contingent on the merger's approval. Tesla will be announcing new financial details about the proposed deal November 1, which should offer more clarity and ease some shareholder concerns.

SolarCity is also set to unveil its much anticipated solar roofs on Friday. And while Kallo is skeptical about them--other companies have introduced similar products in the past and then gone belly up--he thinks SolarCity has a chance to be cash positive as early as next year.

With all the recent developments, he says, perspective is changing on the potential merger. "No one loved this deal in the first month after it was revealed," he says. A month after its announcement, Kallo thought the deal had a 50-50 chance of being approved. He now believes the deal has a 90 percent chance of going through.

If the vote had taken place when it was first eligible back in mid-September, Musk might have been in trouble. That decision was pushed out due to shareholder lawsuits regarding the deal. Now, the companies have built up considerable momentum going into the vote.

Trip Chowdhry, an analyst with Global Equities Research, was impressed with the 24,500 cars Tesla delivered in the third quarter. The number was "way ahead of our most optimistic estimate of 22,000 deliveries--a phenomenal execution on all fronts," Chowdhry told Market Watch.

Not everyone is sold on Tesla's cheery outlook, though. Brad Erickson, analyst at Pacific Crest, wrote in a memo Wednesday that he was concerned about demand remaining high for Tesla's vehicles as well as the uncertainty surrounding SolarCity's ability to be solvent. "There remain too many questions for us to turn positive on Tesla," he wrote.

Musk's so-called master plan is to combine Tesla and SolarCity, then create car batteries that can be charged by power from solar energy.

Tesla and SolarCity shareholders will meet separately for the November 17 vote, at which time the future for both companies will become a lot clearer.