Assuming your issue is related to the OpenMaya API and isn't a general programming error...

Maya's really good at managing its object lifetimes...you just have to let it do its job. Some quick rules (a few of which I've learned the hard way :D):
My guess is that you're either trying to use an MObject after Maya has invalidated it (in which case you need to make sure you don't keep MObject instances around too long - get a new node reference from a representation that doesn't expire each time you need the object), or you're keeping a pointer to an MPx* type node and either you or Maya is deleting it prematurely (in which case you need to replace that pointer with a proper Maya attribute and connection).

Not really boost/smart pointer issues, but you might want to check to see if you've got a smart pointer to a smart pointer to something you shouldn't be managing (or something like that), or if a long-lived container has MObjects somewhere in its data elements.

Phill