Just a quick thought...
If you didn't want a total TPK, and the barghest should have tracked them down, one thing you COULD have done was maybe run a "Predator"-esque mini-adventure. Play up their paranoia as the beast slowly and efficently stalks them, toys with them, keeps them as busy as possible while the surviving gobins etc. make way for the evil artifact. Eventually you could have given the PC's somewhere relatively safe to camp out (preferrably in a camp with NPC's) and the barghest would have completed its mission.
After reading the barghest's description, it could have either paused to devour the corpse of the most recently fallen (PC or no) and then opted to stalk the rest.
From the d20srd.org website:
"Though they love killing, they have little stomach for direct combat and attack from ambush whenever possible."
Once the barghest had them on the run, he may have just been sick and depraved enough to follow them. For fun. I realize that this scenario would have been difficult to come up with on your feet, but might be an idea for next time...?