I would start with the filter and clogged line. It needs to be replaced anyway and could be the problem. If the clog is loose bits, it could jiggle around and let fuel through some of the time and not other times. I had a kidney stone like that - sometimes it turned and blocked things, other times it sat on it's end and fluid ran through without issue. ;)
If that doesn't fix it, and since you've already replaced the pump only, I would then go to replacing the whole assembly.
Note, someone with more experience may have better advice.