Robert Stewart, 51, admitted a sexually aggravated breach of the peace by conducting himself in a disorderly manner and simulating sex. Sheriff Colin Miller also placed Stewart on the Sex Offenders Register for three years.
Mr Stewart was caught in the act with his bicycle by cleaners in his bedroom at the Aberley House Hostel in Ayr.
Gail Davidson, prosecuting, told Ayr Sheriff Court: "They knocked on the door several times and there was no reply. "They used a master key to unlock the door and they then observed the accused wearing only a white t-shirt, naked from the waist down. "The accused was holding the bike and moving his hips back and forth as if to simulate sex."
Like most people, my first reaction was one of astonished amusement that anyone would have sex with a bike. But this swiftly gave way to a greater incredulity at the way the law was framed. Does this mean if I unlock a door to your house, come in and catch you having a wank then you too can be arrested, convicted and put on the Sex Offenders Register?
Or is it the use of an inanimate object? In which case, anyone who has a vibrator should take care to properly barricade themselves into their bedrooms if they want to avoid arrest.
It's reminiscent of the Spanner Trial in the early 1990s. The state spent £3m prosecuting a group of sixteen gay men under the Offences Against The Person Act 1861 for having S&M sex. It had all happened in private, it was all consensual, nobody had complained of any injuries, or of anything else for that matter.
The judge ruled that consent was not a defence, therefore the men had assaulted one another and they were found guilty.
I've yet to hear of any police raids on boxing matches or prosecutions of tattooists.
The men at the Spanner Trial received sentences of up to four and a half years. Lives were ruined. The Court of Appeal, the House of Lords and the European Court of Human Rights upheld the convictions.
Somehow I thought those days had gone. But no. Indeed, there's The Spanner Trust - named after the trial - which is still campaigning to defend S&M practitioners and get consensual S&M made fully legal. They report that there have been several successful prosecutions for consensual S&M sex since. It could, and probably will, happen again.
In Robert Stewart's case there's no consent issue at all because there was nobody else involved. So I've a further wave of incredulity for his solicitor, Gerry Tierney.
What paltry effort does it take to successfully defend someone who was having sex by themselves, in their own locked bedroom, the sight of which offended people who walked in uninvited?
What kind of uninterested disregard for Stewart is going on here to let him get convicted? Another report says that in court
Tierney described his client as a "sad little man"
How completely awful as a human being, unfit for his chosen profession, damaging to his clientele and in need of finding another job - preferably cleaning Glastonbury toilets with his bare hands and tongue - is this man?