I've found that wedging the mug betweent the headlight and the U lock around the handlebars is pretty sturdy, but the first couple times I tried it, I didn't have a sealed mug so coffee bounced out and all over my headlight, me, my moped, and most worrisome, the cables on my bike. My 'ped doesn't have shocks, so I was one unhappy camper by the time I arrived at work.
Since then I've switched to using a jar or hanging it off my backpack. A friend has one of those backpacks that crosses over her chest, and she takes a few sips before hooking it into her jacket and securing it in place with the straps. She says it works great as long as she doesn't lean over. This wire thing sounds like a good idea though. I might try to rig that up this summer. I'd say this is a topic that a goodly number of people have given some thought to.