I had a technical phone interview with a company, which shall be referred to as GooglApplaMazonSoft for secrecy. It was basically taking a half hour to code a program to foo bars. I was planning to send a thank you email later today, but have realized that the program has a somewhat critical bug. Should I mention this or not? As further information, I only have an email for the hiring manager not the actual interviewer.
Short answer: If it's something they are certain to find, I would tell them.
It's a hard one, but I would probably mention it rather than let them discover it. Without you telling them otherwise, then they will assume you just didn't know how to write the correct code which will count against you.
Write and email to the hiring manager and explain what the error is and at a high level how you can fix the code (do not give a code snippet). They will be able to pass it on to the interview panel if required. If I were the hiring manager, it shows that you are more likely to own your mistakes by you raising it first :)
I would say just let it go. Nobody expects you to write a flawless program in one go, especially in half an hour. In a live scenario, you would get multiple opportunities to test your code and refactor or rewrite it. Hence, an interviewer is unlikely to hold the mistake against you, if your reasoning was mostly okay.
If the mistake was something really basic that you missed, then sending the email now doesn't help much. The interviewer wouldn't really change his/her impression because you realized it after the interview. ("I can't believe he missed something so basic, but okay, at least he realized it later, so it is fine, I guess!")
The fact that you are sending the mail to the hiring manager and not the interviewer, is even more reason for you to not mention it. The hiring manager isn't going to run down the hallway into the interviewer's office exclaiming, "Hey look, that guy is awesome, he pointed out a flaw in his code!" :)