The Markarth Incident says otherwise. Also, if they can stop the Dominion from entering cities, why don't they just force them to stop their crusade? After all, they can engage in a defensive war.
There's only one city the Thalmor can't enter - Whiterun. The empire would rather not pick another fight with the Dominion because even if the Dominion can't win, it would just result in everyone losing and nothing changing.
There are three reasons Heimskr's still alive:
1. Even if the Empire can't keep the Dominion out of their cities, Jarl Balgruuf the Greater can.
2. Any Unwanted Thalmor that try to get in will try to be rude to Braith, and get their asses kicked.
3. While Heimskr cannot stand against the might of the Dragonborn, he can take on a million elves and come out on top - Talos favors him. The guards clean up the mess.
The reason the Empire puts up with Heimskr is because they're awesome and tolerant like that.