Sounds to me like your sucking air into the fuel lines somewhere. Air leaks can be hard to find, basically just start with the most likely culprit and keep checking till you find it. Sounds like your on the right track. I would think it would be between the filter and tank if it runs good when you fill up the filter.

Also, an air leak won't always leak fuel from the same spot. Air needs a smaller hole to get through than diesel does.