C(39, 12) / C(52, 13) is the formula.
{where C(a, b) is the combination of a things taken b at a time and is computed: a!/[(a-b)!b!] }
There are C(52, 13) possible 13 card hands.
If you have the Q of spades, then there are 39 non-spades to choose 12 from. This is C(39, 12).
= 3910797436 / 635013559600
= 0.006158604610684915...
or 1 about in 162
(not as hard as getting pocket aces in texas hold-em!)
Note: after 113 hands the odds are about 50:50 that you get such a hand at least once. I don't play hearts, so I don't know how many hands an average game lasts, but what happened to you doesn't seem that unlikely.