Good news for David Letterman! Well, sorta.

A Supreme Court judge has turned down Robert "Joe" Halderman's request to toss out a criminal case accusing him of blackmailing the popular TV talk show host...

While prosecutors argue that Halderman demanded $2 million to keep Letterman's affair with staffers quiet, Halderman himself simply says that he offered Letterman a chance to buy a "thinly veiled screenplay about his life." Riiiiight.

If convicted, the Halderman could face up to 15 years in jail.

Think Letterman handled the sitch well? I do! Plus, I'm sure he's also super-happy making fun of the late night wars going on over at NBC!