Diver Vern Unsworth was the target of a Twitter attack from Elon Musk overnight. Now he says he intends to take seek legal action over the slanderous tweets.

The tech billionaire tweeted that Mr Unsworth was a "pedo" after the British national rejected Musk’s submarine idea.

Musk launched an attack on Mr Unsworth, 63, who played a key role in the rescue of the 12 boys and their coach, in a now deleted tweet.

Tech billionaire Elon Musk has sparked outrage after he called one of the Thai rescue divers a "pedo". Picture: AAP (AAP)

Vern Unsworth says the Tesla founder can "stick his submarine where it hurts". Picture: Supplied (Supplied)

“I’ll hopefully get a copy of the tweet. It’s not over,” Mr Unsworth told 9NEWS.

He also said the Tesla founder can "stick his submarine where it hurts" and it had absolutely no chance of working.

“It was just a PR stunt," Mr Unsworth said.

While the rest of the world was celebrating the successful rescue, Musk's offensive comments have cast a shadow over Mr Unsworth's festivities.

Musk visited the cave site before the rescue operation was carried out. Picture: Twitter/Elon Musk (Supplied)

“There is no justification. At the end of the day we were here to rescue these young boys,” he said.

He also said the submarine wouldn’t have been able to navigate the complex tunnels of the Tham Luang cave complex, adding Mr Musk was not needed and was asked to leave.

Mr Musk didn’t take the criticism lying down and launched a furious attack on the experienced diver after responding to a piece in the New York Times which called his effort "commendable".

Dr Zeynep Tufekci, a tech expert, wrote how Mr Musk became frustrated when rescue crews said his contraption was impractical for the task at hand.

"Mr Musk’s desire to help was commendable," she wrote.

"But when the head of the rescue operation, Narongsak Osottanakorn, declared that Mr Musk’s contraption was impractical for the task at hand — a task that had been completed, at that point, by some of the world’s top cave divers — Mr Musk responded with irritation," she wrote.

Mr Musk then responded to Dr Zeyenp's peice and tweeted: "Never saw this British expat guy who lives in Thailand (sus) at any point when we were in the caves

“Only people in sight were the Thai navy/army guys, who were great. Thai navy seals escorted us in — total opposite of wanting us to leave.”

The NYT writer said she was dumbfounded by Mr Musk's tweet and called on the billionaire to apologise.

Others on Twitter slammed Mr Musk, calling him completely out of order.

Meanwhile, the two Australians who helped in the international rescue of the Wild Boars soccer team were given diplomatic immunity in the event anything went wrong during the treacherous rescue.

Perth vet Craig Challen and expert cave diver Adelaide anaesthetist Dr Richard Harris were awarded the protection following negotiations between Australian and Thai authorities, Four Corners has revealed.

Dr Harris played a key role in rescuing the group after they became trapped in the complex on June 23.