I am Ecuadorian and I need a DATV to transit Heathrow, London for 7 hours before going to Sochi, Russia. Can I apply for the DATV in Heathrow, or do I need to do it before traveling?
If you do need a DATV, you need to apply in advance. The whole point of the thing is preventing some people to reach UK territory by making sure they are not able to board their flight without proper documentation.
If you don't have a visa, what is most likely to happen is being denied boarding by the airline in Mexico. You wouldn't even reach Heathrow.