CRAIG FERGUSON might have been upset that he didn't get DAVID LETTERMAN'S timeslot after all . . . because he just announced that he's leaving CBS when his contract is up later this year.

Craig joked, quote, "CBS and I are not getting divorced, we are 'consciously uncoupling,' but we'll still spend holidays together and share custody of the fake horse and robot skeleton, both of whom we love very much."

Craig has hosted the show since taking over for CRAIG KILBORN in 2005.

CBS executives have been hinting that the future of Craig hosting "The Late Late Show" was up in the air, but it's unclear whether they just KNEW Craig would want to leave if they passed him over for STEPHEN COLBERT . . . or, if it was THEIR decision to go in a different direction.

Regardless, Craig's show will continue through the end of the year.  CBS has not named a replacement yet.  Ordinarily, we wouldn't expect anything right away, but they did move quickly in naming Colbert as Letterman's successor.