It's going to update the one the activity is associated with. So if ID 1 was sent an email, it will update ID 1, but if ID 2 went to the web and filled out a form it would update ID 2.
There is info on the community that discusses how to manage duplicates and merging of records, you will also want to work with your sales CRM team to try to limit the visibility of dupes generated on that side of the equation.
Hi Clinton - can you point me to those articles? I've read quite a few but they don't answer them.
What if no email is sent and firstname.lastname@example.org fills out a form, which record does it append to. I always understood it as look for the contact first, then look for the lead, if none exist then create a new record. But I don't know how this is handeled when there are duplicate contacts or duplicate leads.