When he was around 20, Cowgill met his first serious boyfriend in Louisville, Kentucky, where he had gone to stay with friends. The man, a chef 15 years his senior, was an alcoholic. "I remember one fall afternoon I realized that if I drank more than him, his drinking didn't hurt," Cowgill says. "So that day I became the bartender at home. Before that, I had been drunk once or twice, but not like I got drunk with him."

As a teenager in the early 1970s, Cowgill found acceptance in a church choir near his suburban Birmingham, Alabama, home. He eventually attended Birmingham's Samford University, where, he says, he'd do "spectacularly well one semester and then flunk out the next" because of his depressive episodes. He would spend six years in college without receiving a degree. "After having been a very good boy all my life," he recalls, "[college] was when I went very, very bad. I'm gay, and that's when I began to discover that about myself." His Southern Baptist upbringing, family disapproval, and the less-enlightened tenor of the times all contributed to making his coming out "a complicating factor" in his depression. "College was also when I discovered alcohol," he says, "and therein began my demise."

In addition to depression, Cowgill would spend the next two decades battling alcoholism, panic attacks, suicide attempts, even homelessness. Always, though, he found a way to dig himself out.

"Looking back at my childhood," he says, "it's clear to me now that most of my life I suffered from really major depression, even in my early school years. I cried every day. I don't know what I was so upset about, but to this day, if I smell sweeping compound, it makes me nauseous, because it reminds me of grade school."

Many people would not consider Lee Cowgill a man to whom fortune has been particularly kind. But, as he points out, "once you've had any sort of brush with disaster in your life, it gives you a different perspective." Though what Cowgill calls a "brush" was actually more like full-immersion disaster, a situation from which he extricated himself in sometimes excruciatingly tiny increments. His difficulties first became apparent at a time when most people have nothing more on their minds than what they're going to get for Christmas.

Most mornings during nice weather, Lee Cowgill has coffee on the 32-foot-long balcony of his Quincy condo with its view of the building's pool. He moved in just short of a year ago, and it's the first place the 51-year-old has ever owned. "I look out at the fog, listen to the woodpecker," says the soft-spoken man with a graying mustache and warm blue eyes. "Hardly a day goes by that I don't think of myself as fortunate."

In 1990, around the time he started at Pine Street, Cowgill met the man he remains involved with today. "We would talk on the subway on the way to work," Cowgill recalls. It wasn't long before the attraction became clear. " 'Soul mate' is the term that comes to mind." Though they've been together for 19 years, Cowgill is saying no to marriage or even living together. "After being so enmeshed with my ex," he says, "I need separateness in a relationship. That's what works best for us."

He quickly started taking on more responsibility at the store and quit the methadone clinic to work at the Pine Street Inn, a shelter and homeless-services organization in the South End. His first job was to sit in the locker room every night to make sure all of the homeless men took a shower, locked up their belongings, and put on the pajamas given to them. "Not a very glamorous job," he concedes, but it started him toward a supervisory position.

Still, Cowgill had setbacks. "For probably the first five years of my sobriety I would have terrible bouts of depression," he says, despite being on medications meant to control it. "There were at least three more hospitalizations for depression, and I was still having panic attacks. It helped to have a support system."

Through contacts at Alcoholics Anonymous, Cowgill got a job working at a methadone clinic collecting urine samples. Of all places, he says, that was where he began to rebuild his self-esteem -- simply by having a job. He took a second job at a convenience store and moved in with a friend, Bill Norris, with whom he would end up rooming for 20 years, until he bought his condo last July. "He became like the brother I never had," says Norris. It was thanks in part to Norris's support that Cowgill continued to make strides toward becoming, as Norris puts it, "a person who stands up straight and tall."

In 1987, Cowgill decided that to get sober for good he had to break it off with his boyfriend. "There's like an eight-month period where I'd classify myself as homeless. I had left the apartment, and I had no job, no money, no insurance. I was living in public programs."

Things went relatively well for a couple of years, but Cowgill had become physically addicted to booze. Once when he tried to quit, he had seizures and hallucinations for two days and cut himself trying to jump out of a third-floor window. "The sad thing was," he says, "after going through all that I drank again in a week." For several more months he tried to quit on his own, and each failure resulted in a suicide attempt. He also tried detox programs, without success.

Soon the couple were "absolutely enmeshed," he says. "We were never apart. We lived together, worked together, drank together." Unfortunately, because of that last part, they also got fired together, and "everything around us began to crumble." In 1981, they moved to Boston, where the boyfriend had grown up.

Perhaps the biggest leap came when Cowgill discovered computers. At 35, he started attending UMass-Boston to study human-services management, and one of the required courses introduced him to the new electronic world. He soon set up a lab in his apartment, building computers and networks, tearing them down, and putting them back together in different configurations. "I've always had a natural curiosity about how things worked," he says. "Even as a kid, the first thing I would do with a new toy was take it apart."

Now working full time at Pine Street, he was approached to head up its portion of a project to computerize the records of the city's homeless programs. In 1999, he left the shelter to take a job in a temp agency working on computer systems around the area. It proved to be a turning point. "The agency required we wear a jacket and tie to report to the new client," Cowgill says. "We went to Marshalls, and it was an event. We bought jackets, ties, shirts. I was definitely excited and proud."

His first assignment was at the nonprofit Boston Health Care for the Homeless Program. The job soon grew into a full-time offer. "That was an enormous boost to my ego, because they had to pay the agency to buy my contract. Someone wanted me enough that they had to pay what I considered a huge amount of money." In 1999, he started as network administrator, but over the 10 years he has worked there he has taken on more and more responsibility. Today, as technology infrastructure manager, he handles the nearly 50 servers that network 350 employees, eight remote sites, and the wireless systems used by the program's street team.

Pooja Bhalla, the organization's associate director of clinical operations, describes Cowgill as "irreplaceable," while Bob Taube, the executive director, says he's "very kind, very compassionate, genuine, honest, and straightforward." But what makes him unique, Taube explains, is that "he really lives the mission of our program -- but he does it totally behind the scenes. He works with computers and routers and switches, but there's no mistaking that he does it with a passion that goes to the mission." Taube and others say they were surprised when they first heard Cowgill's back story. "The thought of him being someone who was adrift was not the first thing I would have imagined if you'd asked me to make up his background," Taube says.

Jim O'Connell, the program's president and founding physician, says that though many people get off the streets and do relatively well in recovery, they often remain in low-skill jobs. "Lee has transcended the usual limits of success," O'Connell says, "by sheer dint of personality and talent."

As Cowgill explains it: "There are 10-year milestones in my life. I got sober just before I turned 30, began a new career just before I turned 40. And just before I turned 50 I knew I wanted to take the next step -- buy a property and live alone." For several years, Cowgill saved for a down payment. He began canvassing open houses. Finally, he found his dream home, a condo in a converted schoolhouse. Like a proud father-to-be showing off ultrasound images, Cowgill made a website so he could share pictures of the unit with his friends. Then, the deal fell through.

But, as he had so many times, Cowgill rallied. He and his realtors "went on a marathon spree" and found another condo in time to make his original closing date. And his new home has amenities the other one didn't, including that balcony, the pool, and a 10-minute walk to Wollaston Beach. "I think," he says, "things are all for the best."

Elizabeth Gehrman is a freelance writer in East Boston. Send comments to magazine@globe.com.

© Copyright 2009 Globe Newspaper Company.