I'll look at the question from multiple aspects.
Classical mechanics, exact measurements, no thermodynamics, no perturbing forces
In this fictitious universe it is possible to stand our perfectly balanced pencil exactly vertically and perfectly stationary. This is an unstable equilibrium position.
With no perturbing forces, no thermodynamics, no quantum mechanics, the pencil won't fall.
Classical mechanics, exact measurements, no thermodynamics, no perturbing forces except tides
You can balance the pencil vertically for an instant. A moment later, the tidal forces from the Moon and the Sun will have shifted the direction of local vertical. (Aside: tides are gravitational.)
The pencil will fall away from the direction in which local vertical is moving.
Classical mechanics, exact measurements, classical thermodynamics
The pencil will fall in some random direction.
Classical mechanics, realistic measurements
In theory, one can measure to infinite precision in classical mechanics. In practice, we cannot do that. In the world of pencils and bridges, the engineering limitations on ability to measure precisely swamp the tiny quantum mechanical errors inherent in measuring conjugate variables.
The pencil will fall in some random direction.
Comment: This is an inverted pendulum. They fall over -- unless something acts to move the inverted pendulum back toward the unstable equilibrium. Thousands of mechanical engineering students face this problem every year. They have to construct a robot that keeps an inverted pendulum inverted.
Quantum mechanics
The question is tagged uncertainty-principle. The only way to have the pencil be in this unstable equilibrium state is to have perfect simultaneous measurements of its orientation and angular momentum (or equivalently, the position of its center of mass position and its linear momentum). These are conjugate variables. The uncertainty principle says the product of the uncertainty of a pair of conjugate variables is at least $\hbar/2$.
This question doesn't make sense in a quantum mechanics context; it is akin to asking what the laws of physics says will happen given a violation of the laws of physics.