After 24 years together, he was kicked out for behaving erratically — and only then was his secret stash of sex toys and porn discovered.

Marital dispute? Nope.

Welcome to hedge-fund divorces, where the secretive operations can lead to ugly breakups — especially when top executives are suspected of taking proprietary information or clients with them as they walk out the door.

Such was the case this week as the nasty breakup of star bond trader Jeffrey

Gundlach and his former employer, TCW Group, a money manager with $119 billion in assets, heads to an LA courtroom.

In the case, the 51-year-old trader and former exec stands accused of stealing client databases and other company secrets in an effort to build a competing firm.

TCW was quick to air Gundlach’s dirty laundry, revealing in its initial complaint that the firm discovered 12 sex toys, 34 porn magazines and 36 “hardcore sexually explicit DVDs and videocassettes” in his office the day he was fired in 2009.

Gundlach is counter-suing, seeking $500 million in damages tied to his termination.

In court yesterday, the mud-slinging continued as TCW’s lawyer, John Quinn, called Gundlach “bitter” and “unhappy” and told jurors Gundlach allegedly stole so many documents, they would equal two-and-a-half Empire State buildings if stacked.

It’s not the first time a hedge-fund breakup seemed akin to a mobster leaving an organized crime family.

Last year, Stamford., Conn., hedge fund Structured Portfolio Management sued its former star trader, Jeffrey Kong, for $10 million after he left for a rival firm.

Kong countered with his own suit saying SPM cheated him out of millions, blasting SPM founder Don Brownstein for his “questionable” management style.

In a court filing, Kong said Brownstein told him, “I’ll kill you if you leave. The only way you can leave this firm is in a body bag,” while slapping the palm of his hand with a baseball bat, according to local newspaper The Stamford Advocate.

The two sides settled in March amid bickering over whether filings could become public lest they reveal trade secrets.

In another case, a former exec of Chicago hedge-fund firm Citadel Investment Group got into big trouble for lying about erasing files from his computer during an employment dispute.

The hedge-fund executive eventually conceded to deleting files, but said it was only to get rid of his embarrassing porn collection.

Hedge funds generally try to settle disputes privately with former employees, experts said. But once they reach the courthouse steps, things can spiral downward quickly, said Richard Slavin, a securities lawyer in Westport, Conn.