Getting a counteroffer is not the same as what the OP is suggesting. Using another job offer as a leverage for a raise is not recommended by most experts. Just google "Should i accept a counteroffer?". Mainly because you create bad blood at your current employer and you have to be ready to follow through on your threat. Also, that employer you just pushed right to the edge of hiring you is going to be mad you were just using them. There are entire top 10 lists about why it is a bad idea!
I have pleaded the entire "it would cost you thousands to train a new guy, and you will have to pay him to start what i'm asking for right now!" line to bosses before. They are unmoved by financial arguments. It's as if management just decided to take a hard line against "persuasive" raises across the board, nevermind the damage it costs to lose talent.