In rats, the application of a painful stimulus has shown an increase in overall arousal and the ability to learn certain behaviours (The study is neatly summed up in this video: Motivation and Reward in Learning). The experiment with electric shocks is shown on the second half.
It is common sense that human beings would naturally avoid painful consequences, but the deliberate application of a noxious stimulus may also elicit a unconscious response, or conditioning, to avoid those behaviours, which would mean a faster learning rate.
Learning could also be improved because pain is an intrinsically meaningful response, while perceived failure is somewhat weaker and less imediate as a motivating agent.
Could small electric shocks, applied by another individual, or a computer program (maybe even self-administered), have any use in learning? At what specific tasks would this technique be more effective?