Ultra-small, low-power, all-optical switching and memory elements, such as all-optical flip-flops, as well as photonic integrated circuits of many such elements, are in great demand for all-optical signal buffering, switching and processing. Silicon-on-insulator is considered to be a promising platform to accommodate such photonic circuits in large-scale configurations. Through heterogeneous integration of InP membranes onto silicon-on-insulator, a single microdisk laser with a diameter of 7.5 mu m, coupled to a silicon-on-insulator wire waveguide, is demonstrated here as an all-optical flip-flop working in a continuous-wave regime with an electrical power consumption of a few milliwatts, allowing switching in 60 ps with 1.8 fJ optical energy. The total power consumption and the device size are, to the best of our knowledge, the smallest reported to date at telecom wavelengths. This is also the only electrically pumped, all-optical flip-flop on silicon built upon complementary metal-oxide semiconductor technology.