AND NOW, THE WHOLE latenight TV thing can potentially get really interesting. Like, Shakespeare interesting.

In a long-anticipated deal, CBS officially announced last week that David Letterman, at age 59, has agreed to host “Late Show” well into 2010, a year beyond NBC’s scheduled handover of “The Tonight Show” from Jay Leno to Conan O’Brien.

Hold onto something, because this next part will go pretty fast.

Letterman’s extension at CBS means he will theoretically be around after Leno has hung up his spurs, putting him in a head-to-head matchup with O’Brien, who currently occupies Letterman’s old home. In the parlance of “Star Wars” fans, this places the NBC star in the uncomfortable position of trying to defeat his Jedi master.

For the generation of comics and entertainment journalists who were roughly college age when he made his “Late Night” debut in 1982 — a group that includes the 43-year-old O’Brien — Letterman has always been a seminal comedy figure: Hipper than Carson, and the godfather of an acerbic, sardonic form of humor that has flourished and proliferated ever since.

At the same time, recognizing that O’Brien’s material might not be as widely palatable as Leno’s act, Letterman has an opportunity to reclaim the latenight crown he wore for three years, after moving to CBS in ’93, before relinquishing it to Leno in the mid-1990s. It’s no exaggeration to say that being the Avis of latenight has grated on Letterman something fierce, which explains why he flirted with a jump to ABC — at the possible expense of “Nightline” — in 2002.

No guarantees

As I have opined before, nobody really knows what’s going to happen at NBC come 2009. The Peacock network shrewdly tucked all the kids into bed by formally anointing O’Brien the “Tonight” heir two years ago, buying itself several years of profits and tranquility. In the process, though, top brass also alienated Leno, 56, a good soldier who associates say felt betrayed in having been elbowed, however gently, toward the exit door.

Leno’s next move is anybody’s guess, but his range of options puts him in the driver’s seat. NBC could get cold feet and opt to keep its present host at 11:30, in which case O’Brien would surely jump elsewhere, collecting a fat penalty payment for his time. Some rival execs still see this as the likely outcome, especially with parent General Electric assuming greater oversight of the network. As one source put it, “Why would you shut down a division of GE” — that is, “The Tonight Show” — “that’s a leader in its field and brings in hundreds of millions of dollars?”

Yet if NBC sticks to the existing plan, Leno could find eager suitors at Fox or ABC, whose longterm commitment to news in that timeslot remains sketchy at best.

This creates the very real prospect of a three-way Leno-Letterman-O’Brien configuration, though uprooting himself from NBC to start elsewhere would be a gamble for Leno, providing no guarantee he would be equally formidable. And even if Leno eventually succumbs and decides 17 years is enough and playing Caesars Palace isn’t so bad, that still leaves O’Brien and Letterman as competitors, with the likelihood Fox or ABC will seek an alternative means of joining the fray.

The other aspect of the story that will bear watching as Leno’s scheduled D(eparture)-day approaches is the media, which has never been exactly in Jay’s corner. By contrast, Letterman and O’Brien have long been critical darlings, setting up a possible role-reversal for both. Will the press root for Dave, who has long shunned them, to ride into the sunset on top? Or for Conan — a relative newcomer, despite 13 years service — to unseat him?

As games of musical chairs go, situations are rarely as dramatic or clear-cut as this one, with three larger-than-life, use-their-first-name personalities eyeing two established seats, while competitors look for any opportunity to toss another into the ring.

No matter how this play concludes, it seems near-certain latenight’s next act will be deliciously messy. Because while the post-primetime hours feature plenty of jesters, there can only be one or two kings, and as Shakespeare put it, “Uneasy lies the head that wears a crown.”