I usually only stick spies in cities if I want to level them up (only killing an enemy spy on counter-intelligence and stealing techs causes spies to level up, aside from National Intelligence Agency). Stealing techs takes a long time; unless you have several spies doing it in several places, it's not going to change your tech position unless you have as much science output of your own as the civ you're spying on (and so are discovering new techs at the same rate as well as gaining them by spying) since by the time you've stolen a tech they've probably researched two.
This is why constabularies and police stations work the way they do - delaying tech steal makes it largely useless, even without a counterspy on defence. I only use a counterspy if I have a key tech others don't have that I think they may be able to steal (say, if I'm first to Acoustics and don't want to risk being beaten to Sistine Chapel, or first to Astronomy and don't want to be beaten to discovering all the other civs), or if I'm so close in tech to a nearby rival that stealing could put them in the lead.
As a disclaimer, though, I'm playing on Immortal where I'm never anywhere close to tech leader until the latest game stages anyway, so I don't have a lot to lose.
In general, though, I'd say that stealing techs is useful to level spies but most of the time (once they hit Special Agent) you'll want them stationed in city-states or as diplomats. Counterspying is the lowest priority of all unless you're being spied on a lot, and so have a good chance of levelling up a spy very quickly (if he catches multiple spies in quick succession). Also, you can't get intrigue from counterspies and that can be valuable (although you can get a better idea of who's spying on you, since you're more likely to identify the spy - if you kill them you always know who sent them).