At first glance, this all looks right. However, I'm speculating (and will confirm with actual debugging after I post this comment) that the following is happening: when MarsEdit pushes the edit in step #1 above with publish=0, this causes the WP plugin to remove the LJ post in order to "unpublish" it. Then, it re-posts it in step #3 with publish=1, but as a new post since the old post was deleted.
Does this sound like a reasonable possibility? Time to go confirm ...
// This function will delete a post from LJ if it's changed from the published status
FFFFFFFFFFFFFFFFFFFFFUUUUUUUUUUUUUUUUU *rageface*
Well, at least I know what's doing it, now. While I could certainly make a case for MarsEdit *not* editing the post twice, toggling the "publish" bit the way it does ... I suspect it'll just be easier for me to improve the WP plugin to not delete a post but instead mark it as "Just Me (Private)" if it's unpublished from within WP temporarily.
Hopefully, this information I've collected will help some future poor soul who's facing the same issue.
Hi dossy - the MarsEdit behavior is a little "overkill" because it's a generic process that is intended to make publishing work with a wide variety of blog systems. Some systems need the coddling of moving things along with the publish "bit" as you noticed.
At some point I might try to optimize the behavior of MarsEdit to only do the minimum required for WordPress, since it ultimately requires less API activity than MarsEdit currently does.
In the future if you want to inspect what MarsEdit is doing, you can look at Window -> Network Log and get a good view of what it's sending and receiving.