Ages ago, when I was still living with my parents, we had an indoor/outdoor cat that had a habit of going to various high shelves in the house and accidentally knocking things off them.
To curb this behavior, one of us would grab him off the shelf and literally throw him outside (onto grass, maybe 6' in the air), thinking that he would associate the unpleasantness of being thrown with his unwanted behavior.
He did. He changed his behavior such that he would jump up on said shelves and deliberately knock things off the shelf whenever he wanted to go outside.
He was a great cat other than that habit though. Hands down the most social (with humans) cat I have ever owned or met and my sample size on both counts is fairly large. He made everyone he met fall in love with him and had a territory of several square miles given the phone calls from people he encountered who took him in worrying that he wouldn't get home safely (he always did, though one incident when he was gone overnight prompted us to put the home phone number on his collar due to some concerned neighbor who took him in for the night). He also once jumped into a UPS truck that was delivering a package to my parents house - I happened to be looking out the window as the truck was leaving, watched it go halfway up the driveway, stop, and see the driver toss him out of the truck.
My parents have since stopped allowing their cats outside due to the murderous relationship between cats and local bird populations.