How do you counter Warlock?
Any hero that uses a diffusal blade well (i.e. Phantom Lancer, Mirana, Riki) will do relatively well against Warlock. Even then, DoTA is not a game of true "hard-counters", and well played Warlocks will beat not so well played Warlock counters. Warlock is a strong hero (and has high public win percentage) but is essentially ignored by almost every competitive team at the moment (the notable exception being Cloud9 using it as a 4-role). There are a few reasons for this. The hero has a good attack animation/damage early but is easy to gank and does not gank well without his ultimate. Moreover, his most useful team fighting skill (upheaval) is not useful in lane and his most useful laning skill (shadow word) is not useful in team fights. This makes him awkward to skill as a solo and very level dependent (i.e. the above mentioned 4 warlock builds Hand of Midas). This means that under the current metagame, it really does not have the ability to be a competitively viable 2 or a 3 (solo laner), and is quite level/item dependent to be a 4/5 (a support).
In solo lanes, there are not too many matchups that warlock has trouble with. Razor can give you fits as you are slow and really do not have an effective way to stop leeching damage. Heroes with long range harassing abilities can be a problem if they have high ground advantage. The hero does well in 1v1's against essentially all melees.
Generally speaking there are not any heroes that make Warlock look really silly, though this is true of most heroes. The way to get an advantage against such a hero is to gank early, and take team fights in between his long ult cooldown. As a Warlock, you need to take objectives/big team fights with your ult and upheaval.
Besides going for Diffusal Blade, which was already mentioned, you also have a number of other strategies to diminish Warlock's effectiveness:
Play around Chaotic Offering's cooldown. Warlock is quite unimpressive when his ultimate isn't ready, and the fact that he invested ~9000 gold for the quadruple Infernal doesn't help either (means no Shiva's / Hex / Mek / Force Staff to help in smaller skirmishes or when the ultimate is just cooling down). If you can force him to blow his ultimate when he doesn't want to (for example to save himself or his teammates from a gank) you don't have to worry about it for a very long time, thus you can punish him by taking towers / Roshan or just generally playing aggressively without fear of being punished.
Prevent him from getting a good ultimate off. Chaotic Offering works best against clumped heroes in a teamfight, when you can stun them all and shred them with those Flaming Fist procs. If your team just spreads out and forces the enemy team to engage in smaller fights and / or to defend from splitpush, he will be forced to either blow his ult prematurely (and you can punish accordingly for that, see 1.) or to not be very helpful, which can lead to towers or heroes down.
This is quite a general advice, but just killing him repeatedly works very well. Warlock is very susceptible to ganks early (no burst damage / heal is too slow for it to actually make a difference), and is still relatively easy to kill even in mid / late game. Good blink initiators like Puck / Shaker should give your team enough time to just get rid of Warlock before it casts his ultimate, and even assassin heroes like Orchid Clinkz / Storm / similar heroes can just remove him from the fight if the opposing team isn't on point with detection / counter initiation. The fact that Aghs / Refresher don't give that much in terms of defensive capabilities (compared to Mek / Force / Shiva / Guinsoo) means it's even easier to remove from the fight before Chaotic Offering comes out.