Comcast Corp.’s $45.2 billion buyout of Time Warner Cable came together quietly inside of two weeks — and right under the nose of the other heavyweight pursuing the company, Liberty Media-backed Charter Communications.

Comcast had been flirting with TW Cable since last summer, when Charter began pressing the issue with its acquisition overtures to TW Cable. Comcast had also held discussions with Charter about partnering to acquire TW Cable’s holdings in New York City and other key markets.

But as Charter’s pursuit of TW Cable grew more aggressive, Comcast grew more cozy with TW Cable CEO Rob Marcus and other execs. Sources close to the situation said the talks between Comcast and TW Cable for an all-out acquisition heated up only during the past two weeks. Agreement for the all-stock deal, which does not include a breakup fee should things go south, was signed by in New York City at about 1:30 a.m. ET on Thursday as Gotham was battered by a snow storm.

In discussing the deal in a conference call with reporters, Comcast chief Brian Roberts joked that his first order of business was to “figure out how to get home” to Philadelphia given the blizzard conditions in the region.

The Charter camp, led by cable biz vet Tom Rutledge, were seemingly  caught flat-footed by the news of Comcast’s whole-enchilada purchase. Just Tuesday, Charter announced with fanfare its proposed slate of directors for TW Cable as it pressed on with its proxy fight. It’s unlikely that Charter would have made such a move had it been aware of the seriousness of the talks between Comcast and TW Cable.

Charter’s effort to buy TW Cable came on the heels of Liberty Media acquiring a significant stake in Charter, the nation’s fourth-largest cable operator, last year. Liberty toppers John Malone and Greg Maffei have said they believe the cable landscape is ripe for more consolidation in an effort to be more competitive with MVPD rivals. Time Warner Cable, as a pure-play cable operator, was a ripe target.

SEE ALSO: Time Warner Cable Acquisition Drama Getting Ugly 

Comcast execs made those same points in waxing poetic about the deal’s potential to benefit subscribers (even as consumer watchdog groups howled) and nurture cutting-edge technology services.

In the end, Comcast’s offer for TW Cable was richer — significantly, at $158.82 per share vs. Charter’s $132.50 offer — and deemed a better bet by TW Cable’s board.

“We tried to be as thoughtful and as purposeful (and have) very constructive conversations with Rob and his team,” Roberts told reporters. “We had a lot of conversations — last week was a real flurry.”

Comcast CFO Michael Angelakis led the charge for Comcast. He noted that the “cooperative discussions” were made a little easier by the fact that many of the execs on both sides of the table have known one another for years.

Surprisingly, Comcast and TW Cable kept the nature of their discussions quiet until Wednesday night, when CNBC’s David Faber broke the news via Twitter. Although CNBC is part of the Comcast family via NBCUniversal, sources stressed that Comcast and TW Cable had no interest in serving up the story to the media. Rather, they’d hoped to make a surprise announcement at 6:30 a.m. ET Thursday.

As word of the deal spread Wednesday night, Comcast and TW Cable PR and investor-relations execs hunkered down and worked until well past 3 a.m. in Philadelphia and Gotham.

Charter execs could not immediately be reached for comment. On the heels of the formal Comcast-TW Cable announcement, Charter issued a terse statement suggesting that Comcast was overpaying for the company:

“Charter has always maintained that our greatest opportunity to create value for our shareholders is by executing our current business plan, and that we will continue to be disciplined in this and any other M&A activity we pursue.”