In general Thai police don't bother foreigners, especially tourists. If anything they generally go out of their way not to arrest a foreigner breaking minor traffic laws, rather taking the approach that a friendly warning will suffice.
One major exception is drug laws, which most Thai police view as either a social scourge with regard to which it's their duty to enforce the letter of the law, or an opportunity to make untaxed income via bribes. Which direction they'll go often depends on dope quantities; small-time offenders are sometimes offered the chance to pay their way out of an arrest, while traffickers usually go to jail.
A strong anti-littering law was passed in Bangkok in 1997 and there were rumours that foreigners were being singled out for enforcement. Be careful when disposing of litter or cigarette stubs, the police are hiding and waiting for you! espically around SIAM SQUARE.
If you are arrested for any offence, the police will allow you the opportunity to make a phone call to your embassy or consulate in Thailand if you have one, or to a friend or relative if not. There's a whole set of legal codes governing the length of time and manner in which you can be detained before being charged or put on trial, but a lot of discretion is left up to the police. With foreigners the police are more likely to bend these codes in your favour. However, as with police worldwide, if you don't show respect you will make matters worse. (TRY NOT TO GET INTO A FIGHT WITH A THAI PERSON. OFTEN THEY HAVE VERY LITTLE CONCEPT OF DEATH SO SOMETHING SIMPLE, COULD LEAD TO SOMETHING SERIOUS. WALK AWAY!),
Thai law does not presume an indicted detainee to be either 'guilty' or 'innocent' but rather a 'suspect' whose guilt or innocence will be decided in court. Trials are usually speedy.
Thailand has its share of attorneys, and if you think you're a high arrest risk for whatever reason, it might be a good idea to get out the Bangkok yellow pages, copy down a few phone numbers and carry them with you.
Tourist Police Hotline
The best way to deal with most serious hassles regarding ripoffs or thefts is to contact the Tourist Police, who are used to dealing with foreigners, rather than the regular Thai police. The Tourist Police maintain a hotline - dial 1155 from any phone in Thailand, and ask for extension 1.
The Tourist Police can also be very helpful in cases of arrest. Although they typically have no jurisdiction over the kinds of cases handled by regular cops, they may be able to help with translation or with contacting your embassy.