MARYIN HAMLISCH SHOULD HAVE BEEN on top of the world. He'd just picked up three Academy Awards—for best song and score from The Way We Were and for adapting Scott Joplin's rags for The Sting. But when the composer walked into his Hollywood apartment that April evening in 1974, he wasn't celebrating. "Three Oscars in my hands, and I come home and empty the cat litter," he remembers. "I had thought that success would make me happy, but it didn't."

Even two years later, when his music for A Chorus Line earned him a new slew of honors, including a Tony and a Pulitzer, and helped launch Broadway's longest running musical, Hamlisch felt an emptiness. When failures came, that emptiness became a full-scale depression. "I had put all my eggs in the success basket, and when success went, there was nothing left," he says.

Now, at 48, Hamlisch is hoping to fill that basket to brimming again. He wrote an anthem for this summer's Olympics; his memoirs, tilled The Way I Was, are due Oct. 19, and for the first time in six years he is heading back to Broadway, with a musical version of Neil Simon's The Goodbye Girl, opening next spring.

But this time, vows Hamlisch, things will be different. "I'm enjoying my life for the first time," he says. The reason? His 1989 marriage to former Today Show and ABC sports contributor Terre Blair. "With Terre in my life, I've learned to put success and failure in perspective."

For Hamlisch, the pressure to succeed started early. Urged on by his father, a musician himself, Hamlisch, at 6, became the youngest student ever accepted to New York's prestigious Juilliard School (his peers in the preparatory division were at least 8). But his triumphs—in film, on Broadway and in concerts—weren't enough. "When you finish a show, those people in the audience go home to their loved ones, and you go back to the Holiday Inn and order room service," he says. "You start thinking, 'What's my next project?' just to fill the time."

But after Jean Seberg, his musical based on the actress' life, flopped in London in 1983, and Smile, his beauty-pageant satire, bombed on Broadway three years later, "the phone wasn't ringing oil the hook," he says. That, coupled with the 1987 death from AIDS of his friend and Chorus Line collaborator Michael Bennett, forced Hamlisch to look inward. "I realized no amount of career success would add up to what was missing in my life: someone who cared about me and someone I cared about."

By then, Hamlisch—whose romances with Cynthia (Garvey) Truhan, Emma Samms and Carole Bayer Sager (the last inspired their hit 1979 Broadway musical They're Playing Our Song) had faltered—had resigned himself to living alone. A friend suggested he call Blair, an Ohio native working as an independent TV interviewer in Los Angeles. Three months of marathon bicoastal phone calls followed. "She was bringing out all the good things in me," he says. "I found myself quieting down, becoming more understanding of what life means."

But after flying to New York to see Hamlisch, Blair, who had been divorced three years earlier, called from her hotel to say she had cold feet about meeting him. In a panic, Hamlisch went to plead his case and wound up proposing marriage when she finally opened her hotel-room door a crack. "I was standing behind the door with my knees shaking," says Blair, "but I heard the love and sincerity in his voice, and my heart said yes."

Married a month later, Hamlisch and Blair have since settled into his Park Avenue apartment with his cat, Sparky, and their Maltese puppy, Phoebe. "People say, 'Marvin, you're so much nicer now,' " he says. "I say goodbye before I hang up the phone. I even write thank-you notes."

For now, children aren't on the agenda—but "we vacillate," says Blair, 36, who feels their ages are a stumbling block to becoming parents. Meanwhile, Hamlisch is immersing himself—up to a point—in the music for The Goodbye Girl. "I'm as enthusiastic as ever, and I think it's going to be wonderful, but I'm not getting out of kilter about it," he says. "The old Marvin would be crazy by now. The new Marvin's smarter than that."