With the rest of the car in good shape and since you like the car alot, I think it would be an inexpensive way to go. Since you have gotten 300,000 miles from it, you obviously know how to take care of a car, and could possibly get this many more miles from a car you like.
What kind of car can you buy for $5,000? Not much of one. Given that the newest car of this quality, such as a 210 diesel would cost around $30,000, the engine sounds like a bargain to me.
If this were a crappy built car, I would say no, but these cars are built in such a way that they lend themselves well to being rebuilt.
IMHO, you should go for it, but as a previous poster said, noone can make this decision except you.