If you only have hand luggage with you it should be fine. If you are a NON EAA citizen, according to this document immigration should take 45 minutes, say 1 hour 15 minutes while you disembark the aircraft.
To transfer to terminal 3 from terminal 5:
Free shuttle trains are free for travel between Terminal 5 station and Heathrow Central station (Terminals 2 & 3). Please note from 20 May 2018, to travel on the shuttle trains, you can get a free Inter-Terminal Transferticket from the machines in the station. You can also use an Transport for London Oyster card or a contactless payment card which will not be charged when travelling between terminals.
Average journey time: 20 minutes
London Underground trains also run between the terminals. The transfer is only free if you use a Transport for London Oyster card or a contactless payment card.
Average journey time: 16 minutes
(Source: Heathrow Website)
If it takes you two hours to reach the terminal say, you have over two hours left which is more than enough time.
To qualify under EC 261 compensation, it needs to be under the same ticket:
Under EC 261 your tickets need to be booked under the same booking reference. This means that even if your journey includes several legs, they must be all under a single ticket.
(Source: Air Help)
Wouldn’t I get the compensation for the flight from STR-LHR if the flight from Stuttgart to London is delayed by 3+ hours? Just for the single flight? Also I am a German Citizen which means I don’t need to go through customs, right? Also will I need to go out of the airport and inside again?
You would get single flight compensation, your wait at customs is 25 minutes and you will need to exit the airport for the transfer.
So the only gamble I take is that the BA flight from STR to LHR is not delayed by more than about 3 hours or be cancelled? There is an Eurowings flight at 1pm which arrives at 1:35pm in LHR, do you think I should book a ticket (around 35€) to be on the safe side?
It should be fine.