How did I know where to add it? Well, I first looked at showthread.php to find out how posts are displayed. Then, I saw a call to the getpostbit function. This function was called for each post in the thread, so I figured that is where all of the variables and calculations were done. So I went to functions.php and found the getpostbit function. As far as where to put it in the getpostbit function, I just decided to skim to the bottom since all of the other stuff didn't pertain to or affect what I was trying to do. However, it would have been pointless to put it at the very bottom of the getpostbit function, since the postbit template would have been evaluated before the $level variable was set. So I just put it above the place where the postbit template was evaluated.
Is that what you were asking? If not, then just PM me and I can give a more detailed answer.
BTW, I agree that the little hacks can be the most fun