Following jcaron and other people online who have the same issue as you, technically you can leave South Korea and come back to reset your visa-free travel. There is no written rule on how many times you can renew tourist visa by entering and exiting the country, as the government has the right to kick out or detain any one. It probably will look suspicious that you left the country, went to Japan for a few hours and came back.
In this scenario it might have been best to get a D-2 visa for education
(Full link)
http://www.studyinkorea.go.kr/en/sub/overseas_info/guide/guide_visa.do
Visa for Regular Educational Program (D-2): Eligible people who intend to receive education in a standard course (Bachelors, Masters, Ph. D) or research specialist fields in junior colleges, universities, graduate schools established according to the Korean Education Law, or academic research institutions established under the provisions of a special law of a status as least as high as a junior college. You will need the following documents
- Valid Passport
- Visa application form or Certificate for Recognition of Visa Issuance
- Processing Fee: Amount corresponding to USD 30 (Single-entry) or USD 50 (Multiple-entry)
- Admission from the school with its Recognition of the student’s aptitude for study and financial ability
- Most recent certificate of school record
- Verification of Account Balance
- Family Registry (Applies to Chinese only; Must include whole family)
※ In case of getting a recognition of visa issuance or visa issuance recognition number, you only need to submit a valid passport, visa application form, and the visa issuance recognition (or number)
If you need the visa rushed and have a Korean to sponsor you, you can get a Recognition of Visa Insurance
Certificate for Confirmation of Visa Issuance: In order to shorten the issuing period and simplify visa issuance procedures, an immigration office head can issue a certificate for recognition of visa issuance after examining the applicant's documents upon the request of a sponsor in Korea. Then, the Korean missions overseas will issue a visa based on the certificate. The certificate is required except for special cases. The applicant or sponsor in Korea can apply for the certificate at the nearest immigration office (or its branch) with required documents. When the certificate is issued and sent to the applicant, then the applicant can get a visa by submitting the certificate to the nearest Korean missions overseas. The certificate is effective for three months and valid for a single visa application.
You wouldn't have to risk of going to another country and back. Plus, it is cheaper if you paid the visa processing fee than 2 airline tickets. Do remember that in order to get the visa, you must be outside of South Korea to get it processed.