Whoops! Bad enough Michael Douglas‘ son Cameron got pinched for drug trafficking by Feds but his own psychiatrist revealed in court that he’s a police informant!

The potentially dangerous secret to someone behind bars was divulged for all to hear at a bail hearing for Cameron at a Lower Manhattan federal court building in Foley Square.

At the hearing Dr. Robert Millman confirmed Cameron had been released to house arrest last summer "because he was going to be an informant."

Defense lawyers argued that the damning statement be stricken from the records but feds now fear the rat is out of the bag.  Literally.

Douglas’ lawyers argued he should be released on bail to get treatment for his heroin addiction.

As The ENQUIRER reported previously Cameron was busted again when his girl friend slipped him dope hidden in an electric toothbrush while in police custody. Cameron Douglas pleaded guilty on Wednesday to dealing cocaine and methamphetamine in large quantities while his father showed his support.

The judge deferred ruling on bail while Douglas hopes he doesn’t end up in the same cellblock as some of his former drug buddies he may have informed on.