The Holy Spirit distributes spiritual gifts according to his own will (1 Cor 12:11 and Heb 2:4). That is, the distribution is the unilateral decision of God (1 Cor 12:18). When Paul advocates that the Corinthians "earnestly desire the greater gifts" (1 Cor 12:31) he not referring to the "what", but to the "how". For example in Romans we see the the contrast between the what and how.
Romans 1:11-12 (NASB)
11 For I long to see you so that I may impart some spiritual gift to you, that you may be established; 12 that is, that I may be encouraged together with you while among you, each of us by the other’s faith, both yours and mine.
Paul is not talking imparting the "what" (spiritual gifts) to them, but the "how". That is, by exercising spiritual gifts for edification (in love), we are able to "gift" the blessing of our spiritual gift(s) to others.
In other words, he loves the believers in Rome and wants to edify them through the exercise of his spiritual gifts (and likewise them with him) so that they would all be encouraged together.
Again in the first epistle to the Thessalonians we see the same.
1 Thessalonians 3:9-10 (NASB)
9 For what thanks can we render to God for you in return for all the joy with which we rejoice before our God on your account, 10 as we night and day keep praying most earnestly that we may see your face, and may complete what is lacking in your faith?
We pass the "gift" of blessing to others for their edification, when we exercise our spiritual gifts in love. These are the so-called "greater gifts" that Paul is talking about in 1 Cor 12:31. He is not talking about the "what" (gifts unilaterally given to us by the Holy Spirit), but the "how" (the use of those same gifts to "gift" the blessing of edification to others in love). It is this latter type of "gift" that we should earnestly seek to desire, so that we may selflessly give it to others.