As a foreigner to Thailand, you are required by Thai Immigration Law to initially enter the Kingdom on a Visa if you wish to stay long term in Thailand.

This can be a visa (tourist visa for 60 days or non-immigrant visa for 90 days) issued by a Thai Embassy or Consulate outside of Thailand. Alternatively, they can obtain a temporary stay with under the Visa Exemption Rule (VER) which Thai Immigration law allows citizens of 41 countries the permission to ente the Kingdom for a limited period of time (up to 30 days depending on the nationality). This is commonly referred to as a 30 day stamp.
Specifically for the Visa Exemption Rule (VER), under the new rules the foreigner will be permitted to enter and stay not more than 90 days combined in a 180 day period. Remember that under the VER, you are allowed 30 days maximum on each visit. For example, you visit Thailand seven days in January, seven days in February and seven days in March. For the period at April to June, you will be allowed to enter and stay not more than 69 days (30 days maximum for each entry).
The Thai government amended the Immigration rules which took effect on October 1, 2006. The purpose of the change was twofold; First to increase security for Kingdom by requiring foreigners to follow strict guidelines for their stay in Thailand. Secondly, to ensure foreigners who work in the Kingdom to obtain the proper work permit and are paying tax due to the government.
After you arrive in Thailand, you may request for more time for your stay from Thai Immigration. This is called an "extension of stay." Typically, a short term extension of stay is granted up to 30 days for Tourist Visa or Non-Immigrant Visa. Many people who come to Thailand desire a long term extension of stay. They may apply for an extension of stay for one year. However, their extension of stay must be for one of the following purposes: Business, Education, Marriage or Retirement. If you hold a tourist visa, you must first convert to a non-immigrant status before the long term extension of stay.