i own a 1988 320i and shes been pretty good to me ever since i bought the car slight oil leak from the sump which ive made worse

and it idles a bit funny,i just guessed that the icv was packing up it idles at normal rpm (just above 800rpm) and every now and again it would slowly drop to about 4-500rpm then rev back up again to 800, never stalled which was the funny thing, and guessing becuase of that it has a slight cough under load now and again. never really payed any attention to it coz it ran really well until driving back to where i live 1 night went to overtake a granny in her rover and when i went past bout 4000rpm it surged but it only does it every now and again and only did it past 4000, below it was fine i still ignored it coz it still ran very well untill a couple of days ago. i think the fuel pump has packed up but a bit concerned about it. it makes a very distinctive whining sound steadily getting louder as its getting louder the more the engine gargles and non responsive under load and idle is sounding very hit and miss.
found a lot of crap in the tank after syphoning about 8 litres out .
the pump itself looks like the original, part no. 0580 453 019/12v 014 842-15 bosch part
do i just get a replacement pump or is there any other checks that i need to do? the fuel filter is brand new on it and i made sure it went the right way round, i regurly use the stp fuel treatment stuff bout every 4000miles i bung a load in. would a new pump cure the surging i get past 4000rpm?
cheers matt