Not getting what one wants as a good thing or something to be thankful I understand that craving stuff leads us to suffering (Second Noble truth) and that getting what we think we want won't lead to happiness. 

However, is there any explicit indication that it's even good not to get what we want? (any similarity with The Rolling Stones' lyrics is just a coincidence). 

The only quote I can find is from the Dalai Lama:  'Remember that sometimes not getting what you want is a wonderful stroke of luck.
Certainly not getting what you want is unsatisfactory. This is Dukka Dukka. I will not say this is a good thing though this kind of thought can help you emotionally. Sometimes it might be true that not getting something may be better as you might be blinded by craving as not to see the downside e.g. a partner lower in morals. 

Even if you get what you want this is not satisfactory as you have to part with it at some point.

The root cause of craving is sensations experienced then in contact with the object that you want or mental satisfaction in owning it (has come into the spear of mine).

If you don't get something wanted then the sensation you experience is painful. You have to look at it as impermanent or if you are developed in meditation as arising and passing of sensations (phenomena which is experienced or felt). By doing this you are weakening your root of aversion. 

When you experience satisfactory experiences you have to look at the sensations again equnimously. When you experience the pleasantness passing away do the same. This is because doing so weakens the root of craving. 

When you experience neutral sensations, the process of fabrication continues. Use this as means to eradicate your ignorance. Neutral sensations are unsatisfactory since we still have conditioned existence. 

By reaction to sensations you create craving. Carving with further thinking and pondering and conpept polifration  creates clinging. At this point you will be planning on how to aquire what you want. If you miss de railing the train at feeling this is the next place you can try this by developing mastery over the mind. This is nothing wrong working towards getting what you want within the framework of morality and right livelihood. But in doing so you should try to be equanimous as possible to sensations and try developing more mastery over the mind to prevent craving and clinging.