Ruling on Cousin Marriage in Islam
Question

Is it correct that our Prophet Muhammad (peace and blessings be upon him) discouraged marrying cousins? Should marrying cousins be the last resort?
Praise be to Allah.Can you marry your cousin?
There is no objection whatsoever in the Islamic religion for a man to marry any of his relatives except al-maharim (those forbidden for marriage ) whom Allah mentioned in Surat Al-Nisa, 4:23 (interpretation of the meaning):
“Prohibited to you (for marriage) are: your mothers, daughters, sisters; father's sisters, mother's sisters; brother's daughters, sister's daughters; foster-mothers (who breast-fed you), foster-sisters (who breast-fed from the same woman as you); your wives' mothers; your step-daughters under your guardianship, born of your wives with whom you have consummated marriage, no prohibition if ye have not consummated; (those who have been) wives of your sons proceeding from your loins; and two sisters in wedlock at one and the same time, except for what is past; for Allah is Oft-Forgiving, Most Merciful.”
Thus, when Allah mentioned for us the relatives to whom marriage is forbidden, we then come to know that there is no objection for the remainder of the family relations. 
Should marrying cousins be the last resort?
Furthermore, there is no condition that it be the last resort as indicated in the question. Among the most prominent evidence of this fact is that the Prophet (peace and blessings be upon him) married his daughter Fatimah to ‘Ali (may Allah be pleased with them) and he is the son of her father's uncle, as well as the marriage of the Prophet himself to Zainab bint Jahsh (may Allah be pleased with her) and she is his aunt's daughter (i.e. his cousin); and there are many other such examples.
However, a different question may be asked, namely: "Is it better or preferable for a Muslim to marry someone he is not related to rather than a relative?"
The answer to this question varies from case to case, and perhaps it may be preferable to marry people who are non-relations, for example if one aspires to form new social ties or bonds, and regards the existence of a marriage relationship with a different family as constructive in widening the circle of social bonds.
For more about marriage to cousins in Islam, please see these answers: 98931 , 222086 , 12335 , and 5240
And Allah knows best.