I understand the fact that ionic compounds are good conductors of electricity in molten state. But why aren't they good conductors in solid state. Cannot ions vibrate about their mean position and transfer electricity in the same way as they transfer heat?
Electric charge is transferred by physically moving charged particles around. In the case of an electric current moving through a wire (for example), the electrons are moving.
In an ionic compound, the ions are locked in place. They can move around a little bit, but there is not much translational motion - the ions stay in their places on the crystal lattice. In addition, the ions are "happy" with the number of electrons that they have. The ions formed in the first place by giving up or accepting electrons in order to minimize the overall potential energy of the system. If an anion were to transfer an electron back to a cation (for example) the energy of the system would increase, and so in general, transfer of electrons after the compound has formed is not favorable.
In solution or in a molten state, the ions themselves can move around - they become the charge carriers. In a solid, the ions can't move, and so electricity cannot be easily transferred.
You mentioned heat transfer - heat is the transfer of the kinetic energy of atoms and molecules. Heat can still be transferred (in some cases quite easily) in an ionic solid because, as you said, ions can vibrate about a mean position. When this happens they bump into their neighbors, which spreads the kinetic energy around.
In summary, ionic compounds don't conduct electricity very well because the charge carriers can't move through the crystal. They can conduct heat because the kinetic energy itself is the "heat carrier" - it can be transferred without moving ions too far from their mean positions.
Ionic compounds do not conduct electricity in solid state because electron motion results in electricity being conducted but in solid state the constitutive particles are strongly bonded or in fixed positions; thus, they can't move from one part to another. In molten state, the ionic compound is split into ions, and ions are charged particles that are free to move so ionic compounds in water or in molten state conduct electricity.