An LPF on the input might be a good place to start. The transient appears to be a much higher frequency than the tach signal (but you need to make sure that's true for higher tach frequencies). Just place a small capacitance in parallel with the input side of the opto-coupler and see if it improves. Keep adding capacitance until the noise goes away or your signal starts to fall apart.
If a simple LPF doesn't work (or if it is degrading the nice edges of your signal too much), try an LPF followed by a Schmitt-trigger (LPF on input and Schmitt trigger might work, but if you use a Schmitt trigger that can handle 12V, putting it on the input side would keep the edges through the opto-coupler nice and square).
If all that fails, you could try to fix it in software: the noise only occurs intermittently, so taking the mode of a few cycles should eliminate it.