If you have to announce you are leaving before they acknowledge (or realize) your value to them, you should probably leave no matter how much they offer you. That's hard to do if you really like the place, but it's usually a sign that there are bigger problems. I took a counter offer once, and it worked out OK, but things always felt a little awkward with my manager after it.
you don't have to threaten to leave to get a raise; you talk with your manager and tell him what you think you're worth and why its important to you that you make that, and you have a conversation about it. maybe you haven't demonstrated that you're worth it (go get a blog, speak at a user group, go earn your credibility). maybe the organization doesn't value talent at low levels [1], in which case you'll never get top compensation.