Both are great boats. I sailed and loved my H-18 for many years.
That having been said - I'd go for the 5.8.
The main thing is that the hulls of the 5.8 offer more buoyancy in addition to the boat weighing less. If you sail heavy, or want to take additional people out, this extra freeboard really helps. One thing I hated about the 18 was the drag the hull lip produces and the slapping of the beams and tramp by the waves. The 5.8 is faster, and is fairly robust as well. The 5.8 platform is easier to keep stiff, and the traveler works better.
Early 5.8s are not foam cored (forget which year the switch happened), you easily see what you have looking into the inspection ports. While the foam cored hulls might be preferable, the solid glass hulls are still robust and might get a price break by mentioning it - but I wouldn't use that alone as a reason to walk away from it.
The only other factor to consider is whether you want to one design race - the 18 might be easier to find a class event for. But, don't kid yourself - the 18 is also a dead class boat and it may be just as hard to find OD action with that (depends on your area). If you're going to end up on open class anyway, again go for the 5.8. If you're only after recreational sailing, I'd still go for the 5.8, unless its condition is far worse than the 18 you have.