This question already has an answer here:
I’m Jordanian, traveling to Germany via London. I have a Schengen visa, do I need a transit visa in London?
The critical information needed to answer your question is whether or not you need to transfer in London (i.e., collect your baggage and board another plane). If the answer to this question is no, then you do NOT need a transit visa. If the answer is yes, then you need a transit visa.
There are situations where you can ask the Immigration Officer for a concession such as an onward flight within 24 hours and a valid visa for your destination. It is the IO's decision and basically down to their discretion. If the IO decides in your favour, you can continue your journey. If the IO makes an unfavourable decision, you will not be allowed to proceed. If you think that you will not receive the concession, then it's best to apply for a transit visa before your travel.