An apprentice painter got a harsh reality check when he was jailed for blowing a chewing gum bubble in an Australian court.

But it's the magistrate's turn to feel deflated after his decision to lock up the bubble gum-blowing defendant was quashed.

Mirza Zukanovic, 20, raised the ire of Magistrate Rodney Crisp when he blew the bubble during a hearing at the Moorabbin Magistrates Court in June 2010.

Crisp, who said Zukanovic blew a very large bubble and popped it while looking in his direction, promptly sentenced the offender to one month's jail for contempt.

Zukanovic was thrown into the cells and spent 12 hours in custody before the Victorian Supreme Court granted him bail following an appeal by his lawyers.

Yesterday, a judge burst the magistrate's bubble when he quashed the conviction, saying Zukanovic was denied a fair hearing.

Justice Jack Forrest said Crisp did not allow Zukanovic to seek legal advice, plead guilty or not guilty, or argue his case. "Mr Zukanovic was not given the opportunity to put his side of the case and was therefore denied a fair hearing," Forrest said.

"The magistrate's decision will be quashed."

Forrest said the Supreme Court did not condone acts of contempt but "firmness must be accompanied by fairness".