Another example of this is the popularity of Linux (marketing) over OpenBSD (quality).
Ultimately, the larger developer base allowed Linux quality to beat OpenBSD quality as well.
Good marketing is usually not a trick.
That may have played a role in this, but not a major one. What probably contributed most to the success of Linux was the commercial redistribution and accompanying marketing efforts by companies like SuSE (they even sent free CD sets to unimportant Open Source developers, including me) and Red Hat.