I think my button issues started earlier than 3 months so consider yourself lucky
The head part is the 510 connection "unit" on the top of the Zmax. There is a seam visible between the main body of the zmax, and the top part. It's either just press fitted in, or glued, either way I just put the head part in a vise and slowly rocked the body off of the head part and it came apart fairly easily.
Be careful if you do this though, as the top cap is hardwired to the
device so if you pull the body off too quickly you could pull too far and snap the wire, or damage the circuit board in some way. I'm sure it varied a tiny bit
device to device, but on mine the top cap could be moved about 3/4" away from the body with the length of wire they used.
To replace the top cap I just put the whole device into the vise and carefully squeezed it until the top cap was seated back into the body. The hot glue part was the most difficult for me, I have a huge old-school hot glue gun with a very large, blunt nose on it, so it just kind of pours hot glue all over the place, so it was tricky getting just a small amount of glue in the proper places to firm up the circuit board without totally covering the insides with hot glue.
A small craft gun like you have should work much much better. And obviously remove the battery while doing this, not only for safety, but so that the pressure on the board will be relieved so it's not glued back into place in a tweaked position.