Are fossil fuels about to become extinct?

A worker cleans the panels in a solar power park run by the Costa Rican Electricity Institute (ICE) as the power company has managed to produce all of the electricity for the nation from renewable energy sources for more than 80 days straight on March 26, 2015 in Guanacaste, Costa Rica.
Joe Raedle | Getty Images
A worker cleans the panels in a solar power park run by the Costa Rican Electricity Institute (ICE) as the power company has managed to produce all of the electricity for the nation from renewable energy sources for more than 80 days straight on March 26, 2015 in Guanacaste, Costa Rica.

Solar's big heyday may be just three years away as the unsubsidized cost of panels plus storage is set to become cheaper than retail power supply in several large markets, Bernstein said.

"The math would work in: Australia, Japan and Spain. Brazil and parts of California will become economic shortly thereafter," Bernstein said in a note last week. "At that point, solar without subsidy and without kid-glove regulatory treatment, would – if combined with energy storage solutions – be capable of supplying electricity ('on' and 'off')."

It expects solar will reach a cost below $0.40 a watt by 2018, leading to a combined cost of the solar-plus-battery electricity supply of $0.24 a kilowatt hour on an unsubsidized basis in select markets, including Australia, where residential retail power averages $0.26 a kilowatt hour.

Read More This is slowing renewables' advance in Asia

The technology's only problem will become that it lacks scale, Bernstein said.

"Cheaper, cleaner, more reliable, better technologies don't normally take long to address that problem… and destroy the economics of legacy markets in the process," it said.

An unambiguous negative

While Australia's utility customers won't all immediately cut the cord with the grid in 2018 and oil, gas and coal demand won't go to zero overnight, "this is an unambiguous negative for fossil fuels," Bernstein said.

"In terms of legacy businesses, fossil fuel producers will be sitting on depreciating assets with all the incentives pointing to producing as fast as possible," it said. "Utilities will face years or decades of operational deleveraging. Regulators attempting to preserve utility returns will effectively be trying to inoculate their population against the future."

Expectations renewable energy will leapfrog fossil fuels aren't really new, but the timing has been a subject for debate.

Read More Warren Buffett on climate change: Friend or foe?

Late last year, the International Energy Agency forecast that solar would become the largest source of electricity globally by 2050, with various solar-based systems generating around 27 percent of total.

The missing piece

Since 2013, solar on its own has been cheaper than oil or gas for generating electricity in much of the world, but it can't provide electricity when the sun isn't shining, making the battery adoption the missing piece, it said.

"Solar is a source of energy, not a source of capacity," but cheaper batteries change the equation, it noted.

In a separate report Tuesday, Bernstein noted that the cost of Lithium-ion batteries has plunged 94 percent since 1991, or a 12 percent annual decline compounded over 23 years, even as competing fossil fuel prices have been flat or higher.

"Over the next decade, we see several innovations in lithium-ion battery cathode, anode and electrolyte that will continue to drive a further 70 percent cost decline, a doubling of energy density and substantial improvements in safety and lifetime," Bernstein said in Tuesday's note.

That comes on top of the cost of solar photovoltaic panels falling more than 80 percent since 2008.

Bernstein tips Samsung SDI shares as its battery play, rating it outperform with a 230,000 won ($211.08) target price. The stock was trading around 139,500 won early Thursday.

"We have high conviction that lithium-ion batteries are on the cusp of dramatic growth as costs fall to levels that make electric vehicles not just cool, but also economical, and energy storage for both utilities and renewables starts to make sense," it said in Tuesday's note.

—By CNBC.Com's Leslie Shaffer; Follow her on Twitter @LeslieShaffer1