Yes, you can.
In the inbox, just enter the contact name or number you're looking for in the search bar and press enter:
If no messages come up, you might need to try searching in the "Closed" messages tab. Just click on "Closed" just above the search bar, and then perform your search again.