The main issue is the idea that you have to win lane to be useful. That's not the case at all. As long as you don't lose lane against them, then they have little pressure elsewhere. Basically just play safe, don't take too much harass. Don't ever try to all-in him. Ever. Unless you can 100-0 him in one shot. More than likely, you simply aren't going to win lane against a zone mage like Heimer or Azir. Their poke is too strong. They have a stronger counter engage. They simply do more damage without putting themselves in harms way.
What your goal should be is to prevent roams and just don't let them push you out. Against Heimer, if you can just farm and play safe, there's not really anything he can do. 9 times out of 10, if a Heimer gets fed, it's because you or your jungler stupidly thought that just because he's an immobile squishy that he's an easy kill when he's pushed up. Problem is: is turrets do a metric ton of damage.
Farm under tower and just don't give him the chance to Ult+Rocket you to burst you down from low health. Other zone mages do really well against him. Azir is a pretty substantial counter to Heimer, just because he can destroy his turrets and harass from outside of his tower range.
Heimer doesn't scale the best into the mid and late game. He's not bad, but he's no hypercarry, either. Just deny him kills and if you have hard CC, you can ask for ganks from your jungler. Try to clear his turrets when you can with abilities. It's pointless to try to auto attack them unless you have a ton of AD. The most important thing to remember is just because you're not dominating your lane, doesn't mean you're not winning. If you play safe and just let him be annoying, then he won't have the lead to scale up into the game and he'll pretty much just sit there doing nothing.
Also, Heimer can't roam as effectively as some mid laners. Because his turrets are a zone, when he's forced to move, he loses a lot of his damage. If you feel like you can kill him as long as he's not surrounded by 3 turrets, then just wait for him to roam, follow him and kill him as he's moving to gank another lane. The most he can do to turn on you is use stun and rockets and beyond that, all he has is his turrets, which they don't do too much by themselves. He'll probably ult a turret if you jump on him, but all you have to do is just walk away. Even if you don't get the kill, Heimer's ult is down and he has no further protection once it goes offline, making him a pretty easy kill.
TL;DR: Accept that you're not going to win lane, just focus on not losing lane. Farm under tower. Play super safe. Don't stay in lane at below half health. Treat him like an assassin. Kill him if he roams. Heimer gets outscaled by normal champ progression, so as long as you don't feed him, he won't be worth much.