Five months after Lionsgate swooped in to buy TV Guide Network out from under Allen Shapiro, the media investor is back in the picture with a big stake in the cabler.

In a move that shores up its balance sheet, Lionsgate has agreed to sell a 49% stake in TV Guide Network and the TV Guide Online biz for $123 million to JPMorgan Chase’s One Equity Partners and Shapiro.

The minimajor made the announcement Thursday morning just before the stock market opened.

Deal comes three months after Lionsgate bought the cabler for $255 million from Macrovision Solutions Corp. Macrovision had reached a tentative deal late last year to sell the TV Guide cabler and online assets to One Equity Partners and Shapiro — the sides even announced the deal — but then Lionsgate wooed them away before Shapiro’s deal closed.

Those maneuvers would seem to make Shapiro and Lionsgate strange bedfellows in owning TV Guide Network. But Lionsgate co-chairman and CEO Jon Feltheimer said it made sense from a business perspective.

“We always thought we would be bringing in a strategic partner,” Feltheimer said. “And OEP and Allen had always been interested in having a partner. So given their interest in the channel and the alignment of our interests, they are the ideal partners.”

Under terms of the deal, One Equity Partners has the option of buying another 1% of TV Guide under certain circumstances.

TV Guide Network reaches approximately 83 million homes and is one of the 30 most widely distributed cable networks. Shapiro, the former chief exec of Dick Clark Prods., said that the established distribution network was particularly attractive to him as an investor.

Feltheimer and Shapiro said in interviews that no major immediate changes will take place at TV Guide, headed by prexy Ryan O’Hara. Shapiro said that the online assets are especially valuable and predicted they will assume the former stature of the TV Guide magazine in terms of providing consumers with programming information.

Macrovision, the Santa Clara, Calif.-based tech company, bought TV Guide parent Gemstar-TV Guide last year to obtain the TV Guide-branded interactive program guide and other proprietary technologies. It sold TV Guide magazine to an equity group for $1 and assumption of debt (Daily Variety, Oct. 17) and took a writedown of $208 million on its fourth quarter earnings based on the decrease in value of the TV Guide Network and online operations and the modest coin they fetched in the sale.

Lionsgate execs have said TV Guide represented a natural fit with its growing library and an asset in helping to promote the company’s theatrical releases. Billionaire investor Carl Icahn, who holds 14.5% of Lionsgate stock, had criticized Lionsgate management for using its revolving credit line to pay for TV Guide.

Lionsgate is partners in the horror channel Fearnet with Sony and Comcast and in the premium channel Epix, set to launch in October with partners Viacom and MGM.

Shares of Lionsgate rose 19¢, or 3.5%, to $5.60 on the New York Stock Exchange.

Lionsgate is best known for its “Saw” and Tyler Perry franchises on the feature side. It also produces TV series “Mad Men,” “Weeds” and the upcoming “Nurse Jackie.”