Yes it is possible. To limit IMAP search results just to one element, you should use Expression.UID(Range.Last()) IMAP search criterion and combine it with your IMAP query:
List<long> uids = imap.Search(
Expression.And(query, Expression.UID(Range.Last())
));
VB.NET:
Dim uids As List(Of Long) = imap.Search( _
Expression.And(Query, Expression.UID(Range.Last())))