Complex dynamics associated with the appearance/disappearance of invariant closed curves