In 1996 the border between Thailand and Cambodia was still closed. I had made a loop from Thailand via Laos and Vietnam to Cambodia, and hated the idea of backtracking. I wanted to continue to Thailand but had no idea how to do it. In Sihanoukville, I met an American traveller who had some very detailed information on how to get from there to Trat by boats and walking. I gave it a shot. The trip was uncomfortable but his information was very accurate and in less than a day I was in Thailand but naturally without a stamp as there were no border crossing facilities. I continued to Bangkok and went to the Ministry telling that I entered the country and my passport was not stamped, so could I please get one. Once they found out that I had come from Cambodia, I was sent to the ninth floor where I had to sign various documents written in Thai. After waiting for half a day, some high ranking official comes and yells at me in Thai. A little bit later, some lower ranking official comes to yell in English, so I suppose that he was a screaming translator. I was told that I had compromised my personal as well as the national security and screwed up international relations etc. I got a huge stamp on my passport and got deported. I was told that I had 24 hours to leave the country via Bangkok airport. So no more land excursions. I took pretty much the first decently-priced flight out I was able to find and it took me to Nepal.
Pretty much the same happened in 2010 when I crossed the Darien Gap from Panama to Colombia. After the wilderness I went to the police in a small town asking for a stamp. They didn't quite know what to do with me and always sent me to the next town. After a while I was in Medellin. There the police was not happy at all of my Darien crossing and said that I have to be fined and arrested. Fortunately I knew some people in Medellin who were able to negotiate with the police. It was finally agreed that I would stay with them in a house-arrest and just report to the police every day. Well, reporting usually took 5-6 hours each day, but at least I didn't have to spend nights there. After six days and a sizable (but legitimate) fine, they let me go. I got a special travel permit with my picture and thumb print which made me look even more suspicious.
The third difficult situation was at Kyrgyzstan-Tajikistan border in Sary Tash Valley. Border guards gave me hell and didn't allow me into Tajikistan. I ended up spending the night in the freezing cold border in the mountains. Eventually, with some local help, I got through but the officials refused to stamp my passport (saying that they don't have a stamp, which might have been true). As there were no transportation, I just walked in the forest to avoid the police checkpoints. In Dushanbe I went to talk to some officials but I failed to make them understand what my problem was, and didn't get stamped. I was to depart from Tajikistan to Afghanistan, and I was really worried what would happen at the exit when they see that I have no entry stamp. The outer rim of Commonwealth of Independent States had Russian border guards, and that was also the case with Tajikistan-Afghanistan border. The one I talked to had previously been stationed on the Russia-Finland border and he even spoke some Finnish. He was so happy to meet me there in that remote crossing that he didn't pay any attention to my missing stamps, but just stamped me out and sent me to Afghanistan and wished good luck!