I found out the section 39 info from here, ThaiVisa, then got on to the local SSO at the time while I was still Teaching.
I went around the office on the same week that I finished and applied for it.
Mine was further complicated by my home province being different from where I was working.
As far as I understand it, if you go to section 39, you don't claim your SS payments back, you continue them at the rate of 430 something bahts every month, which gives you free meds and hospitals if you've paid in for, 3 years, I think. Up to a pension if you've paid in for 15 years or so...