Can you buy a re-entry permit before you leave India? That's how it works here in Thailand... if you have a student visa and want to leave and return again. But if you leave without a re-entry permit, the student visa is automatically cancelled.
Ok I did the same thing as you but stayed longer. I was told NOT to enter via Bangkok. So I flew into Chiang Mai and had no problem. Avoid entering through Bangkok and you'll be ok. You are not a marked man or any of that. You just had an annoyed immigration officer.