I'm assuming this is a 4-cylinder.
When I worked at an auto shop over the summer, one of the jobs we did was a head gasket repair on a 4-cylinder Outback (identical to the engine in your car). Factory head gaskets in those engines were a problem, and frankly the fact yours are dead does not come as too huge a surprise.
I'd advise you get them repaired. If your mechanic is good, he can do it for not too much, and the engine should be good for another hundred thousand miles. With resurfaced heads, head gaskets that won't explode, and a nice clean of the inside of the engine, you should be fine for a long time.
Plus, better to stick with your car than potentially inherit someone else's problem.