Hi Rui,
I've just been looking at a wiring harness from a later Pie II, and it seems that the wiring is a bit different.
The newer cable appears to have nine wires instead of eight, and also the colours are quite different.
The throttle connector that come from the Motor has two red wires (in fact one is brown), one grey wire (should be white as in your diagram), and only one black wire (in your diagram you've two).
If your harness is the same as the one I have here, each connector now has a single black wire, and all of these wires are soldered together in parallel where they meet the black wire coming from the cable, which should be safer than connecting a single wire going in series from one connector to the other with lots of crimped joints.
I haven't had a chance to check out all of the pins with the meter, but I did discover that the extra wire is connected to the metal shield part of the 8 Pin plug and is simply left disconnected at the other end with the seven connectors.
Unfortunately, being red-green colour-blind , I'm unable to distinguish which of your two loose wire should be connected to the loose terminal on the pedelec connector, but if you do a continuity check with your meter, you should be able to detect which of the two loose wires is directly connected to the metal shield on the 8 Pin plug, the other one will be the dislodged pedelec connection.
If you're not using pedelec, you could simply insulate the wire instead of reconnecting it.
Regarding your main problem, I would suggest that you try the quick and simple check as described in
this post to first check that the motor and its harness are both working correctly, and then to check the main harness and plug connection as well
(unplug the throttle and join the Red and Grey wires on your throttle connector with a piece of wire). I would also leave the brake switches disconnected while testing, just in case the problem was being caused by a faulty switch.
Please let us know what you find.
Alan