In a surprise twist in the hunt for Time Warner Cable, Comcast Corp. is closing in on a deal to buy its closest cable rival in an all-stock deal valued at $44.2 billion, or about $159 a share.

CNBC first reported news of the agreement late Wednesday. A source close to the situation confirmed that the sides are set to announce the surprise deal on Thursday morning. Media watchdog orgs were quick to condemn the deal as anti-consumer.

Comcast's move to buy all of TW Cable is a stealth play given that it had also been discussing the possibility of teaming with Charter Communications to buy selected systems from Charter if a deal was completed.

Charter, controlled by John Malone's Liberty Media, has lead the charge to turn Time Warner Cable into a takeover target during the past few months. Charter's most recent offer for TW Cable was at $132.50 a share, while TW Cable execs rebuffed that price as "grossly inadequate" and let it be known that they were seeking at least $160 a share.

TW Cable shares have been on the rise amid the jockeying with Charter and speculation about other suitors. The stock closed up 41 cents on Wednesday to $135.31.

On Tuesday, Charter pressed its proxy fight by proposing a slate of 13 independent directors for TW Cable and asserting that the cabler's shareholders had indicated "overwhelming desire" to see a deal done with Charter.

As late as Tuesday, there was widespread speculation that Comcast would cut a deal with Charter to buy out TW Cable's lucrative New York City-area cable systems if Charter was successful in its pursuit. Now that Comcast is poised to swallow the whole company, the nation's largest cable operator will overnight gain a big presence in the two largest TV markets, New York and Los Angeles.

Reps for Comcast, TW Cable and Charter did not immediately respond to requests for comment.

Deal between Comcast, which has about 23 million subscribers, and TW Cable, which has about 13 million, is sure to raise regulatory scrutiny.

CNBC, a unit of Comcast-owned NBCUniversal, reported that Comcast was prepared to divest as many as 3.3 million subscribers in order for the deal to pass muster at the FCC. The FCC no longer has a hard cap on cable ownership, as it does for broadcast TV stations, as the previous limit of no more than 30% of U.S. households was overturned by the courts in 2009 after a challenge from Comcast.

A source familiar with the deal said Comcast intends to argue that combining with TW Cable does not affect competition because the two cablers operate in different markets. The combined companies would reach just under 30% of U.S. cable subscribers, and Comcast will point to the national reach of competitors including satcasters DirecTV and Dish Network and the TV services offered by telcos AT&T and Verizon. Moreover, all of the traditional MVPDs face increased competition for subscription dollars from upstart over-the-top services such such as Netflix, Amazon Prime and Hulu Plus.

The consolidation among Big Cable heavyweights is a sign of changing times for the MVPD biz. Even the largest disturbs are facing increasing tension with programmers over carriage fees, particularly in the sports arena. Charter Communications execs have made the case that cable operators now need more size and scale to remain competitive and offer more seamless access to mobile broadband and cutting-edge digital services.

Ted Johnson contributed to this report.

Related stories New Apple TV to Be Unveiled in April: Report Comcast Adds Warner Bros. to Digital HD Offerings Charter Sets Nominees For Time Warner Cable Board As It Presses Case For Takeover