Yep, only two things will cause that issue and for one the sensor you got is not the right one. The one wire, thin blade connector sensor is the one for the gauge.
Either you have a bad connection somewhere between the gauge and sending unit or you have electrical interference from the alternator. Im going to guess bad connection at the sending unit though. Again, common. Ive seen the stock wire held on by one strand of copper many times. Best thing to do is crimp a new blade style connector onto the harness and get a new sending unit if the one you have has play between the blade and sensor body. Like Cliff said, most are held on by a little rivet or tiny screw and yes, they get loose and cause that issue.