Update to the solution of this problem:
The keyboard/power socket has 28 pins. In normal operation, the power button shorts pins 27 and 28 to do a power-on action. Pin 27 should be at 2.0 V (or 3.1V if charger is plugged in) and pin 28 is at 0V (start counting the pins from the left, while looking into the socket from the ribbon side), when the keyboard ribbon is unplugged. On my Aerobook, pin 28 is somehow pulling down pin 27 to 0V if the ribbon is plugged in, even if I am not pressing down on the power button.
My solution: pins 25 and 26 are not in use, so I cut out them out on the ribbon connector, and align the pins this way: pin 26 to wire 27 on the ribbon, pin 27 to wire 28 on the ribbon (look at the new photo). Given that pin 26 is 0V, this will allow the power button to short the 2V(or 3.1V) on pin 27 to 0V, yet avoiding the problem I have with wire 28. On the photo, you will see that pins 25 and 28 are now not connected to anything on the ribbon connector. Voila, the laptop now will power up/down reliably, without shutting down inexplicably.