As said you can only miss the last leg. A soon as you miss a leg the rest of your flights are cancelled.
You might also come across a problem missing the last leg if you check in luggage (no problem if just hand luggage) you can ask them to only check the luggage to LHR but they won't always oblige. What you have to try do is fly into Gatwick then out of LHR to Dublin on return(or visa versa) so you have to collect luggage.
Other option is get a late flight to Dublin then you have more chance of then allowing you to collect before you should re-check to Dublin.