James A. Gagliano is a CNN law enforcement analyst and retired FBI supervisory special agent. He is also an adjunct assistant professor and doctoral candidate at St. John's University in Queens, New York. Follow him on Twitter: @JamesAGagliano . The views expressed in this commentary are his. Read more opinion on CNN.

(CNN) In "The Decay of Lying -- an Observation," an essay in Oscar Wilde's iconic 1891 collection "Intentions," Wilde penned one of the most iconic lines of the nineteenth century -- "Life imitates Art far more than Art imitates Life."

Indeed, the entertainment industry often relies on imitation to create art. But to Wilde's point, there are likely many less publicly acclaimed instances where an actor's performance in a scripted role has served a higher purpose than simple audience entertainment. And in this instance, my own professional career took inspiration from a 1980's actor who pretended to be an FBI agent.

It can be said that I have lived a true-life FBI story inspired by a masterful piece of fiction and an iconic television character depicting an undercover federal agent who assumed the alias of Vinnie Terranova. If not for Terranova, my FBI undercover identity, Jimmy Falcone, may never have been brought to life -- real life.

The association began in 1987. Following my graduation from West Point and commissioning as a 22-year-old second lieutenant, I was stationed at Fort Benning, Georgia -- before the proliferation of cable viewing options, when the Big Three television networks ruled prime time. In September of that year, producers, Stephen J. Cannell and Frank Lupo, tapped a 30-year old actor from Chicago, Ken Wahl, to portray federal agent Vincent 'Vinnie' Terranova in a new CBS television series, "Wiseguy." The gritty crime drama was a groundbreaking hit, relying on quirky plot twists and soap opera story arcs across a single season. It became must-see television for me and countless other fans. Wahl became a pop culture phenomenon.

Wahl's turn as Terranova, an FBI agent assigned to the fictional Organized Crime Bureau (OCB), earned him critical acclaim and Golden Globe Awards . And when I completed my military service in 1991, his character and his performance -- unbeknownst to Wahl, of course -- inspired me to join the FBI. Graduating with New Agent Class 91-6 in May of that year, I received my badge and credentials from President George H.W. Bush and was ordered to the Bureau's New York division.

Mugshot of Special Agent James A. Gagliano as "Jimmy Falcone," during FBI undercover operation "Bad Bet" in 2002.

I immediately requested assignment to its Organized Crime Branch -- the real-world mob-busting unit that may have inspired the "OCB" where Terranova was assigned. I was somewhat shocked to learn that my ask was accepted and I soon reported to the Brooklyn-Queens Metropolitan Resident Agency as a newly-minted member of Squad C-16. The squad focused on the criminal activities of the Gambino "La Cosa Nostra" (LCN) crime family , and was actively engaged in an investigation and prosecution of the unapologetically flamboyant Gambino boss, John Gotti , and his tough, no-nonsense underboss, Sammy "The Bull" Gravano

Throughout the dizzying preparations in early 1992 for the impending federal prosecutions on murder and racketeering charges for Gotti, Gravano and co-conspirator Frank Locascio, I spent several months acting as a "handling agent" for Gravano, while housed in a protective unit, or "safe house" with him during his innumerable debriefings by the FBI and Justice Department. Gravano was quite the character. It was easy to comprehend how his star had risen so quickly within the crime family's ranks. He was charismatic and lightning-quick with a quip, and thus began our comfortable -- yet always professional -- relationship.

Gravano, who admitted involvement in 19 homicides as part of his plea deal with the government, also served to demystify Mafia practices and traditions for me. We did daily push-up and sit-up workouts together, sparred with boxing gloves and spent countless hours discussing criminal activities of the LCN's five families in New York City during the 1970s and 1980s. One evening, after scouring northern Virginia for the Italian meal ingredients he requested to cook his preferred marinara sauce, we leaned back against the countertops in the cramped kitchen and chatted away.

It was surreal that casual banter with a federal agent came so easy to "The Bull." Here stood a young Fed and a tough-as-nails underboss laughing and joking together -- almost as friends. For me, fond memories flooded back of nights transfixed by the televised images of the fictional Terranova coyly engaged in similar chit-chat over meals of bracciole and broccoli rabe with Sonny Steelgrave, "Wiseguys"'s fictional Atlantic City mobster brilliantly played by the late veteran actor Ray Sharkey . Terranova had successfully infiltrated Steelgrave's crime family, following an arranged extended stint in prison designed to provide him the necessary bona fides -- referred to in the FBI as "backstopping," or plugging holes in your cover. By cozying up to Steelgrave, Terranova learned of all his dark Mob secrets, prepared to ultimately betray that loyalty by testifying in court against his friend.

FBI surveillance team photo of "Jimmy Falcone" meeting a target in 2002.

Several years after the tutorial from Gravano, I had completed a number of assignments in the Organized Crime branch and counter-narcotics operations on an FBI-NYPD task force. I felt I was finally ready for the next step. If life was to indeed imitate art, it was time to flip the script and study the acting craft of the FBI undercover agent. Wahl had received an Emmy-nomination for his portrayal of Terranova and I was about to borrow liberally from his undercover role. It was time to learn the art of pretend.

Plenty of additional inspiration was available during the mid-1990's. And while Wahl was testing his mettle on the big screen in Hollywood, I became obsessed with the work of legendary, real-life FBI undercover agent, Joe Pistone . Between 1976 and 1981, he famously portrayed Donnie Brasco , a small-time jewel thief, and successfully toppled portions of two LCN families. This led me to consultation with some of Pistone's colleagues, who directed me to the Undercover and Sensitive Operations Unit (USOU) , the secretive directorate that sponsors FBI undercover training -- a two-week crucible that hones an undercover agent's (UCA) street chops.

After completing the rigorous course in New York City, followed by an exhaustive battery of psychological tests and intimidating interviews in front of a panel of career UCAs, I finally received my certification in 1996. Initial assignments were minimal in scope. The bureau's undercover program subscribes to the crawl-walk-run progression of role assumption. They paired me with another UCA legend, Joaquin "Big Jack" Garcia, and my first roles were serving as Garcia's bodyguard, or bag man, or the flunky that tested the drugs or counted the money, making sure everything related to the deal was in order.

Undercover work is inherently dangerous. In most instances, you are wearing a "wire" to record conversations and your gun is deeply hidden on your person, making retrieval in a life-or-death emergency difficult. Missteps don't just cost you investigations; they ultimately imperil your life or the lives of fellow UCAs or case informants. "Big Jack" referred to this as the "no mistakes policy" and explained how even in best of circumstances, things can quickly turn deadly.

Then came the stunning news that talented FBI UCA Charles L. Reed had been murdered by a drug dealer in Philadelphia in the spring of 1996 during a drug buy gone awry. The tragic news stunned and affected the entire undercover community.

Garcia continually reminded me of this cautionary tale as my undercover roles eventually began to expand. I had satisfied the novice non-speaking assignments, and thus began the final phase: assuming a myriad of disparate characters across the next two decades. I portrayed mob associates, drug dealers, boiler-room hustlers, degenerate gamblers and numerous tough guys just like Wahl's Terranova. Targeting narco-traffickers, dirty cops, scam artists and mob enforcers, I seamlessly transformed into Jimmy Falcone . And throughout it all, I wondered if Ken Wahl would ever know how much his character-portrayal on "Wiseguy" had inspired a professional career that concluded with retirement in December of 2015.

Years later, I was saddened to hear that Wahl had suffered debilitating injuries, which contributed to his retreat from the penetrating klieg lights of Hollywood.

I recently reached out on Twitter to Wahl and his wife, Shane, who both work with Veterans and pet advocacies . After relating my story of life-imitating-art, I thanked him for the gift of inspiration. Wahl immediately deflected my praise—and turned it back on me, responding: "To hear how inspired you were by my portrayal of Vinnie Terranova is incredibly gratifying. Furthermore, it is an absolute honor to even comprehend that that was possible for you...Thank you so very much for your service to our country. It's people like you that make me proud to be an American....God Bless You. ~ Ken Wahl."

Get our free weekly newsletter Sign up for CNN Opinion's new newsletter. Join us on Twitter and Facebook

Wahl is the antithesis of so many famous and fortunate folk who having made it and consider their blessings a birthright. His Twitter bio sums him up in one line: "PROUD AMERICAN-No Hero, but played a few..."

From one faux-mob guy to another -- thank you, Ken. Without Vinnie Terranova, the blessings that Jimmy Falcone and my 25-year FBI career afforded me may never have materialized. I, too, am a proud American, and I want to thank you for how your talents inspired me.