It was not quite that clean cut, but revolutions and secession crisis's never are.
The election of Lincoln in 1860 plunged the country into crisis, but he would not be inaugurated until March, 1861. Various editorials, articles, etc. were occurring between November and March, and seven states in the Deep or Lower South had already seceded. In February 1861 there was a Peace Conference at the Willard Hotel in Washington to try and avoid further secession and war. In February, Virginia had not seceded yet.
On April 17, 1861, Virginia voted to secede from the Union. Of the counties that are now West Virginia, only 17 delegates voted for secession and 30 voted against it. As a result, there was a meeting held in Clarksburg (now, WV), and they agreed to have their own convention in Wheeling about a month later in May 13, 1861. Geographically, Clarksburg is near Morgantown (where WVU is), and both are within maybe a 30 minutes drive of the Pennsylvania state line. Wheeling is further north, and the Ohio River runs from Pittsburgh down to Wheeling.
At the First Wheeling Convention in May, hundreds of delegates were there, from 25 of (West) Virginia's counties (there are now 55 counties; I'm not sure if some have been divided since then or only about half showed up).
Switching back to (All) Virginia, a referendum was held on May 23, 1861, and most of Virginia (that was allowed to vote (white, male, etc.)) voted to secede. However, the counties that went on to form West Virginia voted against secession, about 35,000 to 20,000. So secession lost pretty handily in (what became) West Virginia.
The Second Wheeling Convention happened in June 1861, and they issued sort of a declaration of independence. This Second Wheeling Convention voted or appointed on a Governor, and basically claimed that it was the only rightful government for the entirety of all Virginia, because it was the government loyal to the U.S. The Confederates in Richmond claimed they were the entire government for all the counties of all of Virginia. This situation remains not-uncommon in war zones and and when there are war governments.
Within a short period of time (weeks, months?), the Union recognized the unionist "Restored" government sitting in Wheeling, and it authorized the creation of a new state (consisting of the counties that are now WV). This area was briefly called the State of Kanawha (after the river and river valley that runs through Charleston, WV). This area was later named West Virginia. It would be about two more years (June 1863) before all the necessary "paperwork" (forming a government, drafting a constitution, bills in Congress, vote of the Union states, etc.) before it was officially admitted as a State of the United States. But it was mostly occupied by Union forces started during 1861, and was effectively Union territory during 1862 on.
There was a referendum held in October 1861, but the secessionists mostly didn't vote it in and considered it an illegitmate election.