90210 alum Trevor Donovan will guest star on an upcoming episode of Lifetime's Drop Dead Diva.

According to The Hollywood Reporter, the hunky actor will play Keith, a "best man" who loses the groom. Under his watch, the groom ends up across the border and then in prison.

But the highlight for some fans will come when Keith must drop his pants in court after making an embarrassing courtroom confession.

Donovan, who is best known for his role as Teddy Montgomery on 90210, will be a welcome guest star to the series.

"I've been a big fan of Trevor Donovan since 90210," Diva creator/executive producer Josh Berman told THR.

He added: "In this Drop Dead Diva with a Hangover-esque twist, I thought he'd be the prefect best man, who, with the best of intentions, gets the groom in a heap of trouble during an out-of-control bachelor party."

Donovan's episode airs Aug. 11, which marks the show's summer finale.

Stacy's Daddy Donor Drama Continues [VIDEO] 

In the upcoming episode (airing Aug. 4), Jane (Brooke Elliott) and Grayson (Jackson Hurst) represent a pageant contestant who has been stripped of her crown. Outside the courtroom, Grayson and Nicole struggle to define their relationship.

Meanwhile, Kim (Kate Levering) represents her father when he loses his job coaching a little league team and Stacy (April Bowlby) tries to convince Jane that Owen (Lex Medlin) would be her ideal sperm donor.

Drop Dead Diva airs at 9 p.m. Sundays on Lifetime.