I'm Dying Up Here will live to see another day.

Showtime, in a move that surprised move industry insiders, has opted to renew its Jim Carrey-produced drama about the stand-up comedy scene in the 1970s. Season two, which will again consist of 10 episodes, will begin production in the fall for a 2018 debut. Sources say the pickup is part of a larger package deal that also includes another show.

I'm Dying Up Here ranks as one of the premium cable network's lowest-rated shows of the year with a modest linear viewership. The drama launched in June to 167,000 linear viewers after an early online sampling. The first season wrapped Aug. 13 with a season average of 143,000 total viewers and a 0.04 rating among adults 18-49, with a slight improvement when delayed multiplatform viewing was factored in. The show debuted in the prime post-Twin Peaks slot but with the David Lynch/Mark Frost revival struggling to draw linear ratings, it was hardly the lead-in Showtime anticipated.

The returns for the drama, based on the book by William Knoedelseder and from showrunner Dave Flebotte, rank lower than the recently concluded Twin Peaks and best only John Ridley's critically praised miniseries Guerrilla.

In the Peak TV era, ratings tend to be one of many factors networks consider when making renewal or cancellation decisions. Critical reviews have become increasingly valuable, but I'm Dying Up Here has a middling 62 score on Metacritic and 51 percent on Rotten Tomatoes. (THR's Daniel Fienberg called the Melissa Leo starrer a "well-acted sprawl that soars when it mines meaning from the boozy, smoke-filled desperation of its milieu and bombs when it tries to shoehorn themes in artificially.")

The decision to renew the series comes after Showtime CEO David Nevins told reporters at TCA this summer that the option on the show's writers had been picked up as the cabler waited to see how the show held up in its new post-Ray Donovan slot. Speaking with THR about the renewal, Showtime programming president Gary Levine admitted that pairing I'm Dying Up Here with Twin Peaks was a mistake and noted the cabler plans to air the show with a different lead-in when it returns next year — though it's too soon to know what it will be paired with. Levine stressed the pickup was on the strength of the show's creative — the writers have been working for months on a pitch for season two — and declined comment about another potential series being part of the deal. Instead, Levine stressed he was excited about Showtime's upcoming pipeline of originals.

The pickup comes as Showtime's two biggest hits — Homeland and Shameless (both produced by outside studios) — continue to age. The cable network's drama slate also includes Billions, Ray Donovan and The Affair, with closed-ended miniseries Escape at Dannemora starring Benicio Del Toro and Benedict Cumberbatch entry Patrick Melrose both in the works. Daniel Craig starrer Purity — picked up with a two-season order — will not air until after Bond 25 (possibly in 2019). Lena Waithe entry The Chi also is awaiting a premiere date. Next up this year are comedies White Famous (starring Jay Pharoah) and SMILF (written, starring and directed by Frankie Shaw).

"It is gratifying that so many comedians tell us this series really nailed the comedy club experience,” Levine said in a statement. "The talented ensemble of I'm Dying Up Here, led by the brilliant Melissa Leo, and an equally skilled creative team behind the scenes, tell stories that scale the heights of comedy and the depths of drama, often at the same time. Having heard their plans for season two, I’m excited about the journeys these characters will take and the new ground the show will break."

Clark Duke (Hot Tub Time Machine), Andrew Santino (Mixology), Erik Griffin (Workaholics), RJ Cyler (Power Rangers), Al Madrigal (The Daily Show) and Jake Lacy (Obvious Child) co-star in the series, which is exec produced by Flebotte, Carrey, Michael Aguilar and Christina Wayne.