Is it okay to replace the Relief valve on a water heater, or do I need to get a new water heater?
Water ran into the electronics of the heater and caused a small fire?  

Yeah, probably going to be cheaper and easier replacing the whole thing than trying to figure out every part that damaged by that.  Especially since it had to be manfunctioning in the first place to overheat like that.

Water coming out the relief valve like that can indicate a serious malfunction - that valve isn't the whole problem. It is what makes the tank leak instead of explode.