Hi again,
First, thank you all for your help.
It didn't work well with either schematics here had here, there was too much noise, specially at low RPMs.
So I followed the links posted by ams0178 to add hysteresis, and this the schematic I got working pretty fine (at first).

As I explained in my 1st post, my goal is to control the speed of a motor by controlling the supply of the injection pump.
When I hookup the rest of the circuit I got (schematic bellow) to control the pump, instead of via an external adjustable power supply.
There was some kind of interference and my rpm reading got crazy (much higher than the real), so I guessed more noise :-/
Then I started looking at the signals in the oscilloscope, but when I connected the oscilloscope to the sensor pins the noise got "filtered" somehow.
I don't understand this, but it was always reproducible. When the oscilloscope is connected on the sensor leads (along with my circuit), the RPM reading is fine. If I disconnect it, it goes crazy.
Here is the "power" part of my circuit:

Can someone explain why this is happening? (and hopefully a solution that is not leave the oscilloscope connected

)