At some point, a higher income will always make up for any related loss of funds, assuming positive investment returns. How quickly you reach that break-even point is determined by your rate of return and your additional savings from a higher salary.
If you're investing in something like CDs you can use your actual rate of return. If you're in stocks or whatever you'll have to estimate. Picking a lower rate of return will exaggerate the value of that $12k, meaning you'd need a more significant raise or a longer time period to make up for the loss of the $12k. This will give you a conservative estimate of how long it will take you to break even. If you're more optimistic, go with a higher rate of return.
For example, I'll assume a pretty low constant rate of return of 4%, compounding monthly. Then we'll compare an investment of $12k making 4%/yr with no additional contributions to an investment of $0 making 4%/yr with monthly contributions of $X.
$X is the additional savings per month you'll get in your new higher-paying job.
If you move to a new job and make $5k/year more than you used to, your break even point will be about 49 months, or 4 years and 1 month.
I threw together a quick spreadsheet and attached it to this post. Play around with the additional annual savings from your increased salary (remember to factor in taxes, if applicable) and the rate of return and you'll see the data and the line graph change. Once the "Difference" column is positive (black), you will have made up your $12k loss. You can also see this break-even point where the two lines cross each other on the chart.
Try setting the additional savings to a reasonable level and the rate of return at 0%. Watch the graph as you change it to 1%, then 2%, then 3%, etc. and you'll quickly get a feel for how the rate of return affects your break-even point. You can also hold the rate of return constant and change your additional savings in a similar way to see how your savings level affects things.
Lastly, madmax is right. $12k is insignificant compared your how happy you are in your job, and your new job could be farther away, increasing your commute time, or you could dislike your new job once you started working there. There are many other things to consider, so weigh those things against your expected break-even time period and you should be able to make a good decision.
I hope that helps, and good luck!
edit: It took me a while to figure out how Bateauxdriver was arriving at $2k/month. Then I realized (s?)he was just dividing your $12k by 6 months, and getting $2k/month, and while that's technically correct, I don't think it answers the question, really. Any increase in pay is essentially permanent, and you don't need to make up the $12k in 6 months, you just need to make it up before you retire (and hopefully well before you retire, if possible).