For future reference, and to further clarify for Sir Osis of Liver what I meant.
Reattribute posts:
UPDATE {db_prefix}_messages SET ID_MEMBER='THEIR__NEW_ID' WHERE postername='Old_Nickname';
For example, if the guest posts now show "LexArma" and you wish to reattribute them to a new member with the name "LexArma" and ID number 105, the query would be
UPDATE smf_messages SET ID_MEMBER='105' WHERE posterName='LexArma';
This would effectivily return all the posts written by anyone using the name LexArma, to be linked with the account ID 105.
This would NOT fix the post count though, and for that you should probably try this mod
Member post recount and run maintanence.

( The mod is old but may work still, I'm not sure )
Personal Messages (maybe partial):
UPDATE {db_prefix}_pm_recipients SET ID_MEMBER = 'NEW ID NUMBER' WHERE ID_MEMBER = 'OLD ID NUMBER'
UPDATE {db_prefix}_personal_messages SET ID_MEMBER_FROM = 'NEW ID' WHERE fromName = 'OLD USER NAME'