Drugs - forget it.
Drug-smuggling carries a maximum penalty in Thailand of death. Dealing drugs will get you anything from four years to life in a Thai prison; penalties depend on the drug and the amount involved. Travellers caught with even the smallest amount of drugs at airports and international borders are prosecuted for trafficking, and no one charged with trafficking offences gets bail. Heroin, amphetamines, LSD and ecstasy are classed as Category 1 drugs and carry the most severe penalties: even possession of Category 1 drugs for personal use can result in a life sentence. Away from international borders, most foreigners arrested in possession of small amounts of cannabis are released on bail, then fined and deported, but the law is complex and prison sentences are possible.
Despite occasional royal pardons, don't expect special treatment as a foreigner: you only need to read one of the first-hand accounts by foreign former prisoners to get the picture, but if that doesn't put you off you could always visit an inmate in a Bangkok jail. The police actively look for tourists doing drugs, reportedly searching people regularly and randomly on Thanon Khao San, for example. They have the power to order a urine test if they have reasonable grounds for suspicion, and even a positive result for marijuana consumption could lead to a year's imprisonment. Be wary also of being shopped by another foreigner or local dealer keen to earn a financial reward for a successful bust (there are setups at the Ko Pha Ngan full moon parties, for example), or having substances slipped into your luggage (simple enough to perpetrate unless all fastenings are secured with padlocks).
If you are arrested, ask for your embassy to be contacted immediately, which is your right under Thai law, and embassy staff will talk you through procedures.
The British charity Prisoners Abroad (www.prisonersabroad.org.uk) carries a detailed Survival Guide on its website, which outlines what to expect if arrested in Thailand, from the point of apprehension through trial and conviction to life in a Thai jail; if contacted, the charity may also be able to offer direct support to a British citizen facing imprisonment in a Thai jail.