with a lot of bad sectors you will have less than desirable performance.
i cannot tell you if replacing the hard drive will solve your problem, the coffee spill may have causes several issues. when you replaced the keyboard was the laptop cleaned? i mean if your coffee had cream or sugar in ti, you could be pretty gunked up in there.
Well this could still be a memory issue what settings did you use to test your Ram? For example I find a standard 2 pass test (wich I think is default) has told me ram is ok, while a 4 pass extended test has failed the same ram. The test will take longer to run but it will tell you if it fails, the more passes the better. With that said tho dont go over bored because I think that each pass take longer than the last, so if you got the time a 6 or 8 pass test works best start before bed then go to work, come home check on it it.
The next thing I would ask is when you spilt the coffee did you quickly turn the laptop off and remove the battery? also did you let it dry for a long time? The reason I ask this I bought Sig other a HP dv7 not to long ago and 1st week we had it he knocked a Margarita over on it (he almost died). The thing turned on and ran ehh soso, it would freeze, fail to boot ect, the touch pad stopped working or would work intermittently. Well it took me two tries (because I was in a hurry the first time) and about 4 total hours, but I took the laptop apart and cleaned every, connector, ribbon cable, and touch pad I could find. The computer works just fine now. I mean I found Margarita on the bottom of the hard drive, so don't worry too much if your ram passes. With enough time and patience you can take apart your laptop and clean it. I have a crap ton of adivce for this if your interested.