I'm also having trouble identifying whether an incoming email has been responded to.

I don't think the logic above works if the email direction is incoming but is part of a thread. The parent activity id will contain data but how do you know whether it has been responded to? In this instance whether it has or hasn't been responded to, the parent activity will still contain data.