Mitt Romney was heavily involved in the extremely messy divorce of one of his key supporters … and the Boston Globe is going to court first thing Wednesday morning in an attempt to unseal the court file as well as lift a gag order … TMZ has learned.

The divorce was between Staples co-founder Tom Stemberg and his first wife Maureen. We’re told the divorce battle lasted for years and was extremely ugly.

Sources tell us Romney gave both a deposition in the divorce and testified in the trial. According to our sources, the Boston Globe got a tip that there was “juicy information about Romney” in the sealed documents.

Romney, Stemberg and Maureen were all served papers by the Globe notifying them that the paper was trying to unseal the case and lift the gag order enforced on all parties.

According to an article in the Boston Globe in 2005, Maureen received nearly 500,000 shares of Staples stock in the divorce … but sold half her shares before the company went public.

Stemberg and Romney’s business ties go deep. Bain Capital helped launch Staples … widely seen as the first big success for Romney’s venture capital company — and Romney sat on Staples’ board of directors for many years.

Our sources say Tom has filed papers opposing the Globe’s motion. Romney’s lawyers have not responded.

Tom has been a major Romney supporter, even speaking for five minutes at the Republican National Convention.