The Good Wife

Miranda Cosgrove is about to find herself on the wrong side of the law on The Good Wife.

Cosgrove, the star of Nickelodeon's iCarly, will play a troubled pop star in need of Alicia's representation after she's arrested on a DUI charge.

Judging from the picture Cosgrove tweeted Wednesday, Sloan will not only cause some havoc in court, but also help heat up the ongoing tension between Alicia (Julianna Margulies) and rival Cary (Matt Czuchry).

iCarly's Miranda Cosgrove inks deal for more episodes

"We're big iCarly fans, so we really couldn't think of anyone better for this role than Miranda Cosgrove," co-creator and executive producer Robert King told Entertainment Weekly earlier this month. "We were thrilled when she agreed to do it. It'll be fun to see her handle both the comedy and drama in the role, and we can't wait to see how she'll play across from Julianna."

Cosgrove's episode will air on Nov. 16.

The 17-year-old actress joins a long list of upcoming Good Wife guest stars, including Michael J. Fox, Elizabeth Reaser, and Lou Dobbs.

The Good Wife airs Tuesdays at 10/9c on CBS.