The creator of ABC’s “The Goldbergs” is in a race against the clock to salvage what he calls “the best episode we have ever written.”

Adam Goldberg tells FOX411 he has mere weeks to shoot an over-the-top “Thriller”-themed Halloween episode — but is so far unable to license the Michael Jackson hit from its composer.

“Rod Temperton wrote the song,” Goldberg says. “[He said] he doesn’t think it belongs on TV. Only in movies. So we are stuck.”

Goldberg — whose real real childhood serves as the basis for the 1980’s-set sitcom — says his team has been trying to “retool” the episode and even considered using a rip off of the Halloween anthem.

“But it is really difficult to do it right without that song,” he admits.

“We are supposed to shoot in [September]. So I have a month to try to make it work. If not we will have to write a backup script. A different Halloween episode.”

A request for comment from Temperton’s U.K.-based attorney was not returned.

“The Goldbergs” has become a breakout hit for ABC, garnering huge ratings for special episodes pegged to ‘80s touchstones like “Ferris Bueller’s Day Off” (which featured a cameo from Charlie Sheen).

The show’s third season kicks off September 23 with a tribute to the Tom Cruise classic “Risky Business.”

“We had touched upon it in a prior season but I wanted to do a big blow out — including sinking a Porsche,” Goldberg says.

“The Goldbergs” airs Wednesdays on ABC.