There is not a fixed rule for which words in which an intervocalic “s” occurs are to be pronounced with a /s/ and which ones with a /z/. Short of having well clear the origin and evolution of each word, one has to check each on a dictionary.
Of the examples in the question, the tradizional, standard Italian pronunciation for mese is /'mese/ (see Dizionario di ortografia e pronunzia by Migliorini et al., Treccani dictionary, De Mauro dictionary, the paper ones I have checked – Devoto-Oli, Zingarelli – etc.), for cosa is /'kɔsa/ (DOP, Treccani, De Mauro), while for esercizio is /ezer'tʃitsjo/ (DOP, Treccani, De Mauro). So two out of three have /s/ rather than /z/.
Other works, like the already mentioned one by Canepari, take into account regional variants which can differ from these.
Especially for a foreigner studying Italian, personally I'd suggest to begin by following “standard Italian” pronunciation, while at the same time – if so inclined – paying attention to the different regional variants. For instance, one will notice that zio (“uncle”) is often pronounced /dzio/ rather than the “standard” /tsio/; and some people, especially in the North, open their closed vowels, so that /per'ke/ (perché, “why/because”) becomes /per'kɛ/, orthographical cue notwithstanding.