The UK and Ireland have an open borders policy. This means that flights from the UK to Ireland are treated as domestic flights, explaining why you would have had to clear immigration at LHR. (Although non-EU citizens still have to clear passport control AGAIN in DUB)
That doesn't excuse the rude BIA (Border & Immigration Agency) officer, but this is nothing new - I am a non-UK citizen living in the UK and face this every time I travel...
-- Mike