Mike O’Malley might well be the poster boy for how roles come to define actors — for better or for worse.

O’Malley found his work slammed by critics in his ill-fated sitcom “The Mike O’Malley Show” and the long-running comedy “Yes, Dear.” Yet when he was offered a guest role by Ryan Murphy, who believed the actor would make the perfect blue-collar dad for gay teen Curt in “Glee,” it turned his career around.

Call it bad juju or good actors stuck in bad circumstances, but many talented actors have found themselves jinxed in their TV careers. But giving a good performance as a guest actor can often switch that luck.

This season, O’Malley scored another strong guest gig as mobster Nicky Augustine on the critically acclaimed FX drama “Justified.”

“So many people have to say yes to you before you get an opportunity to do a ‘Glee’ or a ‘Justified,’” O’Malley says. “I’ve been lucky that there have been people at every network who have given me opportunities to get better so when these guest roles come up, I can execute them with confidence.”

In 2010, O’Malley earned an Emmy nom for guest actor as Burt on “Glee” before being named a series regular.

“It’s the intersection of role and timing,” O’Malley says. “All actors want great material so they are able to shine. In terms of Burt, there’s this emotional weight of the scenes. This journey of Curt is so powerful it just hit the audience in the solar plexus.”

The role of Nicky was supposed to just be a one-shot deal, O’Malley says. But the “Justified” producers decided to expand it into a six-episode run.

“There was a lightness about this character that underscored his menace,” O’Malley says. “Ultimately, he had no respect for people. The challenge was

how to convey that weight in a short time.”

O’Malley says if it wasn’t for “Glee,” there would not have been a “Justified” shot. And without both of those roles, he believes he would not be starring in his fall NBC series “Welcome to the Family.”

This year he’s a strong guest contender for “Justified,” along with another “Justified” guest star, Ron Eldard.

Eldard gained considerable attention in the ’90s with roles on “ER,” HBO’s “Bastard Out of Carolina,” the lead on “Blind Justice” and a trio of short-lived sitcoms. His guest role as Colt on “Justified” had Eldard showing amazing complexity as an Afghan war vet turned hit man.

Eldard says playing guest slots allows actors to be seen in a variety of roles, opening the door for more opportunities to be cast in more parts.

“I tend to lean toward the weird,” Eldard says. “I’ve played tons of dark guys, but also comedy. They can forget that I do comedy until they see that. If they have only seen me do comedy, then they don’t know how dark I can go.”

It wasn’t just a man’s world when it came to great guest opportunities. Amanda Peet, who starred in the snake-bit “Studio 60” on the Sunset Strip, reminded everyone she had considerable acting chops on “The Good Wife.” Carla Gugino, who starred in the critically acclaimed but ratings-challenged “Karen Sisco” and the quickly canceled “Threshold,” showcased just how good she was at comedy in her guest role on “New Girl.”

Zuleikha Robinson, who had hit TV with much fanfare in The X-Files spinoff series “The Lone Gunmen,” turned up in a strong guest role on “Homeland.”

“’Lone Gunmen’ was my first job and I got a little cocky, thinking I’m brilliant and don’t have to work that hard because it comes so naturally,” Robinson says candidly. “It took a lot of time to find my stride and it was really humbling.”

Robinson guest starred as journalist Roya, Brody’s handler for Abu Nazir. Her fate was left up in the air at the conclusion of “Homeland.”

“Only twice have I really had a hard time leaving a character,” says Robinson. “The first was my character in ‘Rome’ and then in ‘Homeland.’ I hope I get to come back and play with her some more.”