Two problems at FRA:
1. It seems that planes taxi forever before actually getting to the gate (assuming that you get to a gate and not to a bus which takes you to it).
2. Terminals at FRA can be far apart, requiring a train ride between them.
No, I would not chance a 40 minute connection.