This incorrect behavior has likely occurred because the sent email is connected to an email thread where the original email in the thread was sent to a different recipient.
In this case, this last email sent in that email thread would be connected to the person and deal associated with the first email in that thread, according to Pipedrive's threading behavior: emails with a matching subject line and two or more matching participants — including the email sender — will be threaded together, and thus can only be linked to one deal.
This overlapped threading may also occur when an email is forwarded from the Sent folder to a different person than the original email recipient — which some do as a means of sending a templated email to many people at once.
To avoid this, we suggest utilizing the Email Templates feature found in the Gold plan of Pipedrive.
For more information about email threading in Pipedrive, click here.