‘Chubby little loser ... see his pug-nosed face ...” Who could have guessed that David Bowie would sing such lyrics? It was a mark of his protean genius, as well as his love of British comedy, that he slipped so effortlessly into playing the grotesquely mocking version of himself demanded by Ricky Gervais and Stephen Merchant’s brilliant script for Extras in 2006.

I fell in love with Bowie aged 11, and also with the wild playing of his pianist Mike Garson. Later I became a pianist myself. Little did I know that I would, years later, be asked by Garson to write his biography, Bowie’s Piano Man, or that I would work with Bowie myself, playing piano for his last television appearance.

I was “the hands” of Bowie that day, playing a piano off-camera to which he mimed his own playing. The lyrics had been sent to him in New York. He was asked to write chords to the song and bring them over. The producer, Charlie Hanson, asked me to do likewise, in case Bowie declined to do so. On meeting, Bowie asked me what chords I had come up with. They were virtually identical. “Spooky,” he said.

Clifford Slapper with David Bowie on the set of Extras. Photograph: Ray Burmiston

Bowie and I spent one afternoon working alone together on the arrangement for the song. We also had to synchronise his arm movements on the filmed piano precisely with my actual playing on the second piano. He had left his reading-glasses in New York, so I lent him mine. He asked how much I had paid for them, and when I said £19.99 from Boots, he replied with a grin of triumph that he got his for 6.99, “and that was in dollars!”

The off-camera banter between Gervais and Bowie had everyone in stitches. At one point Bowie left the room and Gervais suggested it would be funny if he and I perform Lady Stardust for Bowie to hear when he came back in. Bowie appeared delighted and astonished to hear this upon his return. He retaliated by running over from his piano to mine, saying: “Watch this!” and playing his piano intro to Oh! You Pretty Things.

I felt bereft when I heard of Bowie’s death on 10 January. It was a nice irony, which he most likely would have appreciated, that his last appearance on TV was not on a music show, but in a comedy.