First of all, sorry to hear you lost your jacksonii. How long had his mouth been like that?
As to what causes these infections:
According to my herp vet the build up of glandular material can be caused by a lack of (preformed) vitamin A. The temporal glands always produce some of this rather smelly material, but it can get infected if there is too much of it.
I had this problem with my 3 year old jacksonii a few months ago, the vet cleaned it and prescribed batryl. I also bought a new bottle of reptivite, knowing that the old bottle had probably expired and increased dusting with it to twice a month. The symptoms haven't come back, so it seems to have done the trick.