I believe that the most obvious tactic against cavalry is the infantry square formation, which was used by ancient Romans, and later revived during Napoleon wars. But of course the main reason for their creation was to prevent any attack from behind. Still, there was a rule regarding horses in particular, not to shot too late, as wounded horse could tumble at soldiers and break the square. The minimal distance for a shot differs among sources.
The infantry rulebook used in 1807 in Duchy of Warsaw had special chapter dedicated to fighting against cavalry, but it doesn't mention any special order to shot horses.
As for stabbing the horses, to make it possible, first you need to have longer spears than the cavalry itself. In 1811, during the Battle of Albuerra, Polish Vistula Lancers were able to manage the destruction of John Colborne's brigade thanks to longer weapon than British forces (if not to count the fact that British infantry wasn't prepared for the charge).
Bayonets and cavalry charge
"On the Uses and Application of Cavalry in War" by F.W. Bismarck reminds the battle between Turkish and Russian forces, when 500-600 riders of Turkish cavalry decided to make an suicidal attempt in order to break infantry lines. As horses from obvious reasons didn't want to jump on bayonets, riders ordered them to turn around and move back, and this way be killed by enemy's bayonets. This try was unsuccessful.
During the Battle of Dresden in 1813, Russian general Aleksei P. Melissino managed to break enemy lines by riding on bayonets with his horse, while dying with his horse. Although some sources claim he died different way (e.g. from a cannonball), I've asked fellow Russian to clarify that.
Crucial role at the battlefield in fights against cavalry had so called Frisian horses, or Spanish goats (my literal translation of "hiszpańskie kozły" from Polish). Used from the medieval times, they served main role e.g. during Battle of Klissow in 1702, when it made the charge of Polish hussars against Swedish infantry impossible.
As for psychological effect, Polish winged hussars were noted with two elements of distraction caused among enemy's horses. First were the wings, the view and whistle of which was believed to cause fear among horses that weren't used to it. While modern historians still argue about it, the letters of Stephen Batory's administration regarding the preparation of hussar units seem to prove that one of their roles was to scare the opponent in battle. The analogical situation was with pennants and skins of wild animals which were used by hussars.
The second element was shiny armor, which was prepared different way than western heavy cavalry, in order to distract the enemy horses which were scared of that. Unfortunately I completely forgot where I've read about that.