@puzon
I'm not seeing the same issue. I'm using osTicket v1.15.1, Apache, PHP 7.4, and MySQL 8.0.
As you can see from the screenshot below, the first thread entry is a Message from the User. The second thread entry is a Reply from an Agent.

Now, I type another Reply without the User responding.

I post the Response.

And in the email I receive it shows me the "Last Message" which is the first thread entry from the User.

In osTicket "Message" means entries from Users and "Responses/Replies" means entries from Agents. When using the "Last Message" variable (%{ticket.thread.lastmessage}
) it shows the last entry from the User in the Thread. So all-in-all it should show the last entry from the User, not the Agent.
Cheers.