Yes, after Security but before Passport Control. I would allow an extra 30 minutes. For the sake of 200 baht, I would let them do the form and photo for you.
Make sure you use the entrance on the left, which clearly signposts Re-entry permits. The one on the right doesn't. You go through Security first, then get the permit before Passport Control. If you pay the 200 service charge, you only need your passport. They will do the form and photo for you.