McGregor, 20, who is on loan with Airdrieonians, and Gogic, 22, have agreed deals until May next year.
Gogic joined Accies in February after being released by Swansea City.
He made his debut as a substitute in this month's 4-0 defeat by Hearts and started in the following game, also a 4-0 defeat, this time by Rangers.
Gogic began his youth career with Greek champions Olympiacos, where his father, Sinisa, a former Cyprus striker, was youth coach, before joining Swansea in 2013.
He did not make a first-team appearance for the Premier League club.
McGregor joined Accies from Hibernian last summer and made three League Cup appearances for the Scottish Premiership side but did not feature at all in their league campaign.
He joined Airdrieonians in January and has played seven times for the League One outfit.
Cyprus Under-21 cap Alex Gogic, along with fellow defender Jordan McGregor, has won a contract extension after only two games with Hamilton Academical.