Pretty fly for an ob-gyn.

Dr. James Lilja, a former drummer for the pop-punk band The Offspring, came to the rescue of a prospective juror in cardiac arrest during court proceedings Tuesday in Oakland in a medical malpractice suit against him, according to Law 360.

Lilja and his nurse assistant gave the unconscious man CPR and administered shocks with a defibrillator. The man remained unconscious but had a pulse when paramedics arrived.

The doctor’s actions were rewarded with a mistrial, as the judge agreed with the plaintiffs’ lawyer’s motion that other potential jurors who witnessed Lilja’s heroics might become biased against his clients.

“No good deed goes unpunished,” Lilja said before the mistrial was made official.

Lilja is a certified gynecologic oncologist practicing out of San Jose and Fremont, according to his medical office’s website. He is being sued by a couple who is accusing Lilja of negligently mistreating the wife.

Lilja was the drummer for The Offspring from 1984-87 before departing to study at the University of Pittsburgh School of Medicine. The Orange County-based band gained mainstream success in the 1990s with such hits as “Come Out and Play,” “Self Esteem” and “Pretty Fly (For a White Guy).”

Related Articles Photos: Tom Steyer selling San Francisco mansion for $11 million

New ‘Amazing Race’ cast includes Bay Area siblings

Prince Andrew needed Jeffrey Epstein’s supply of women to ‘feel special,’ new book says

Attention Donna Summer fans: You are going to love this

Oakland’s Daveed Diggs, Rafael Casal come to the aid of Children’s Fairyland Lilja played on “I’ll Be Waiting,” the band’s debut single from 1986.

He and his assistant were in the courtroom during the second day of jury selection when the call to help the prospective juror came. The man had been waiting to be called back into the courtroom along with 35 other prospective jurors when he collapsed, hit his head and lost consciousness.

The prospective jurors condition was not known.