I do not think this is German, for one thing it would probably be spelt Thomesch. "sz" in Polish would have roughly the same sound as the German "sch", Tomesz, and Tomec (with a diacritic over the "c") would, I believe, have the same sound in Czech. My personal suggestion is that it is the latter. Where did your ancestors come from and what language did they speak - that would be the clearest indication of nationality.