I am going to Tbilisi from Yerevan and I will arrive around 14:00 and want to leave to Zugdidi on the same night. The train departs on 21:45.
So I like to purchase the tickets as soon as I arrive in Tbilisi
I see little sense in your worries about time limits when acquiring tickets in Georgian Railways offices. There are no essential grounds for it, moreover, tourists reported they bought tickets half an hour before the departure.
As it was kindly suggested by mts, online booking is optimal if you are not completely sure in ticket availability just-in-time.
The only limitation, which exists is related exclusively to online booking:
E-Tickets are to be sold 40 days prior to date of train departure.
E-tickets booked less than 2 hours before the departure time will not be processed.
Selling period starts 40 days prior to departure and ends 2 hours before. Nothing similar is known about offline selling.
The only assumption we can make is that offline selling period starts similarly as online (40 days before), but there are evidences that on-site offices start to sell tickets later than online ones (20 days before). However, this is informal info and shouldn't be treated as a rule of thumb.
The only limitation you should take into account is would you be able to board the train or not.