Yeah, it was after she told him that he put it in the drawer.
So my theory is that he did keep the hat on him at all the times but when he got that emergency call about Ruby in the next morning ( I mean, to put it in there, he would have to be at the station and for all we know, after they found the diamonds, they went to celebrate it in the diner and then probably home with Henry, only to go to the station in the morning to work), he didn’t think much and put it in the drawer and run to find her – he probably thought that he could lose the hat in the forest or something. Stupid though that he didn’t take care of the hat afterwards…