King Frederick William IV of Prussia ( 15 October 1795 â `` 2 January 1861 ) was the eldest son and successor of Frederick William III of Prussia . He reigned as King of Prussia from 1840 to 1861 . King Frederick William IV of Prussia ( 15 October 1795 â `` 2 January 1861 ) , the eldest son and successor of Frederick William III of Prussia , reigned as King of Prussia from 1840 to 1861 .