From a brief google search, it seems that alcohol is banned from 2-5 in an effort to prevent school children from buying liquor. I assume this is a question of supervision, where children are let out of school around 2, but parents are still working until 5, but I can't be certain since I don't live in Thailand.
Interestingly, Thailand also bans alcohol consumption for two days at election time, an interesting take on electoral politics...
The sources I saw also suggested that the laws mostly affect chains and large stores; small "mom and pop" markets will often sell alcohol off-hours to familiar customers. I assume (again) that the government doesn't worry much about this because mom and pop stores are unlikely to sell liquor to their neighbor's children.