Composer Gareth Williams is a remarkable character, perhaps even a one-off. Technically, he's still a student. He has submitted his PhD thesis - a portfolio of compositions - to the RSAMD, and awaits the summons to a viva voce by his external examiners, including composers Gavin Bryars and Nigel Osborne.

While he's waiting for the call, he's hard at work writing an opera. That would be a pretty impressive enterprise for any young student. But this new opera is the third to be written by the engaging, genial and humorous composer from Armagh, who has just turned 31.

Not only is this his third opera, it's the second to have been commissioned from Williams by Scottish Opera, and, like The King's Conjecture, its predecessor in Williams's canon of work, will form part of the national opera company's imaginative and ongoing Five:15 project, which has put composers and authors together with a remit to come up with an opera that lasts just 15 minutes.

How on earth has a young composer got to this position, so quickly, so dramatically and so unexpectedly, before he has even finished his studies?

It's a question that Williams asks himself, recalling that, at our first meeting about three years ago, he wasn't far from suggesting that the idea of himself as an opera composer was almost a contradiction in terms.

At the time, he was working on Love in the Blue Corner, an opera for the RSAMD on the most unlikely of subjects: boxing.

"Mind you," he says. "I did think that, as a theatre of tragedy, a boxing ring is perfect. But I wasn't even calling it an opera to start with. Three months in, I was thinking it was music theatre. Six months in, I was calling it an opera."

Premiered at the RSAMD, Blue Corner turned out to be a brilliant theatrical inspiration, perhaps stronger dramatically than it was musically. "And now I'm doing my third," reflected Williams in his droll and slightly laconic way. "Oh dear. How did I get here?"

Simple, really. At the opening night of Blue Corner, I happened to notice that among the audience was the figure of Alex Reedijk, general director of Scottish Opera, who, though we didn't know it at the time, was cooking up the notion of a wacky project to throw together disparate composers and writers to see if there might be a chemical reaction from which might emerge a new species of mini-opera.

"And at the same time," recalls Williams, "I was knocking on Alex's door to pitch. It was serendipitous, really."

The next link in the chain began to form when The King's Conjecture, the opera devised by Williams with writer Bernard McLaverty, opened at Oran Mor early this year. Sitting in the audience for that opera was a Margaret McCartney, whom I have not yet met. She is a GP working in the west end and a freelance writer.

Apparently inspired by the McLaverty/Williams collaboration, Dr McCartney went off and wrote a short story, which she sent to Alex Reedijk at Scottish Opera.

He took one look at it and thought of Gareth Williams. He showed it to Michael McCarthy, dramaturg for the whole Five:15 project. He also took a look at it and thought of Gareth Williams.

"It's a short story based in a hospital," says Williams. "A really gorgeous story actually. I did wonder if it was a good idea to go back to exactly the same project. And I did ask Alex if he really wanted me back. But the story is strong enough to warrant my saying yes."

So Williams is back on board, and he and the doctor are at work already. "I have some notes written, but there's no title yet; all plot details later."

But it's not just the triple operatic achievement that makes Williams so remarkable. The man is a piano-bar player. His early interests and practical musical experiences, playing and singing in bands, were light years from classical music. "In fact, I hadn't really been into classical music at all until I went to Queen's University in Belfast to study it. I'm a singer/songwriter."

And he's written some cracking songs, not least a heart-stoppingly beautiful lullaby called Tenderhooks, which was a key melodic inspiration for the opera, The King's Conjecture, and is one of a series of lullabies by Williams that are finding their way towards an album.

Not only was he pretty uninvolved with classical music before university, he wasn't into formal composition either.

"I studied composition at Queen's with Piers Hellawell, but I don't think I was very good at it; just interested."

He supported himself at university by going back to his first love, playing in bands and in Larry's Piano Bar in Belfast, presided over by Larry, a legendary figure in the city's night life. "Larry, a big fat guy in a white tux, would just sit in the corner smoking a cigar while you played.

"It was a healthier pastime for a young man, don't you think? It was all about meeting girls really."

Faced with the offer of a London college or the RSAMD to do a masters degree, Williams chose Glasgow and the composition department of Gordon McPherson at the academy.

He had a spell back in Belfast, teaching music to autistic children and, inevitably, getting back into cabaret mode.

"It was mostly hen parties and me playing piano every Friday and Saturday night. There were some raucous things going on, but it was the best musical training I ever had.

"You learn how to pace a night, how to shape the night, how to entertain people and leave them going home happy. It was invaluable training."

And he still does it on Friday and Saturday nights in Glasgow, where you might find him in one of the city's hostelries (he's a regular in the Urban Brasserie, Arta, the Corinthian and the Blue Dog).

He's tried giving it up, but he's a born performer.

"It's supposed to be background music, but I can never help pushing it a bit too far; it always ends up being a bit more of a spectacle than that.

"I suppose this is my shadowy other life," muses the young but increasingly-experienced tyro of the opera world.

"I'm an old piano man. I've been doing it for 10 years, weekly and unbilled. It's good fun, actually, being the piano man. It's a great lifestyle, and I can have a couple of beers while playing."

And with that it's back to the conundrum of creating a new opera out of thin air and the imagination.

"I've been suckered into this now. I don't know how I'd write a piece now without there being a plot or a character in it.

"They're key elements to me now, for better or for worse. I don't know how this happened. You spend your twenties aiming for something: the PhD took most of my twenties. Then you hit 30-31 and where I am now. Am I going to do this for ever? Is this it? That's kinda scary.

"At 24 or 26 you can still do other things. It's too late to get out now, so I might as well give it a proper go."

You can still find Williams in his piano-bar haunts at weekends, however.

And, if you do, buy him a pint and ask him to sing and play Tenderhooks. If you have a soul, it'll break you up.